Skip to content
This repository was archived by the owner on Mar 7, 2018. It is now read-only.

Commit 84a32e2

Browse files
committed
2 parents 8222301 + a9832a2 commit 84a32e2

File tree

12 files changed

+81
-25
lines changed

12 files changed

+81
-25
lines changed

content/researchWarning.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
You are leaving the BRCA Exchange Expert Reviewed portal and entering the portal to view all variant data. This portal contains a much larger set of variant data than the Expert Reviewed portal, and includes variants that have not yet been subject to expert review by the ENIGMA consortium. Pathogenicity assignments are from the original submitters.
1+
You are leaving the BRCA Exchange Expert Reviewed portal and entering the portal to view all public variant data. This portal contains a much larger set of variant data than the Expert Reviewed portal, and includes variants that have not yet been subject to expert review by the ENIGMA consortium. Pathogenicity assignments are from the original submitters.
22

3-
Are you sure you want to leave the Expert Reviewed portal to view all variant data?
3+
Are you sure you want to leave the Expert Reviewed portal to view all public variant data?

content/variantsResearch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
This is all BRCA Exchange variant data. It contains information drawn from multiple databases which have been intelligently merged together, one row per variant. It is intended to provide researchers with a set of BRCA variations and annotations which is as comprehensive as possible.
1+
This is all BRCA Exchange public variant data. It contains information drawn from multiple databases which have been intelligently merged together, one row per variant. It is intended to provide researchers with a set of BRCA variations and annotations which is as comprehensive as possible.

django/brca/settings.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@
7070
'brca-website.cloudapp.net'
7171
)
7272

73-
74-
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
75-
76-
DEFAULT_FROM_EMAIL = "no-reply@brcaexchange.org"
77-
7873
ROOT_URLCONF = 'brca.urls'
7974

8075
TEMPLATES = [
@@ -132,8 +127,8 @@
132127
SITE_ID = 1
133128

134129
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
135-
EMAIL_PORT = 25
136-
EMAIL_USE_TLS = True
130+
EMAIL_PORT = 465
131+
EMAIL_USE_SSL = True
137132
DEFAULT_FROM_EMAIL = 'noreply@brcaexchange.org'
138133

139134
AUTH_USER_MODEL = 'users.MyUser'

django/users/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
url(r'^update/$', views.update, name="update"),
1212
url(r'^password_reset/$', views.password_reset, name="password_reset"),
1313
url(r'^confirm/(?P<activation_key>\w+)/$', views.confirm, name="confirm"),
14+
url(r'^resend-activation/$', views.resend_activation, name="resend_activation"),
1415
url(r'^update_password/(?P<password_reset_token>\w+)/$', views.update_password, name="update_password"),
1516
url(r'^check_password_token/(?P<password_reset_token>\w+)/$', views.check_password_token, name="check_password_token"),
1617
]

django/users/views.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,30 @@ def register(request):
114114

115115
return JsonResponse({'success': True})
116116

117+
def resend_activation(request):
118+
email = request.POST.get('email', '')
119+
user = MyUser.objects.filter(email = email)
120+
if not user:
121+
response = JsonResponse({'success': False, 'error': 'Email not found'})
122+
response['Access-Control-Allow-Origin'] = '*'
123+
return response;
124+
user = user[0]
125+
126+
# resend activation email
127+
url = "{0}confirm/{1}".format(site_settings.URL_FRONTEND, user.activation_key)
128+
plaintext_email = get_template(os.path.join(settings.BASE_DIR, 'users', 'templates', 'registration_email.txt'))
129+
html_email = get_template(os.path.join(settings.BASE_DIR, 'users', 'templates', 'registration_email.html'))
130+
131+
d = Context({'firstname': user.firstName, 'url': url})
132+
133+
subject, from_email, to = 'BRCAExchange account confirmation', 'noreply@brcaexchange.org', user.email
134+
text_content = plaintext_email.render(d)
135+
html_content = html_email.render(d)
136+
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
137+
msg.attach_alternative(html_content, "text/html")
138+
msg.send()
139+
140+
return JsonResponse({'success': True})
117141

118142
def confirm(request, activation_key):
119143
user = MyUser.objects.filter(activation_key=activation_key)

js/NavBarNew.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var NavBarNew = React.createClass({
5858
<span className="BRCA">BRCA</span>
5959
<span className="exchange"> Exchange</span>
6060
</h1>
61-
{this.props.mode === 'research_mode' && <span id="research-label" className="label label-info">All Data</span>}
61+
{this.props.mode === 'research_mode' && <span id="research-label" className="label label-info">All Public Data</span>}
6262
{this.props.mode === 'default' && <span id="research-label" className="label label-info">Expert Reviewed</span>}
6363
</a>);
6464
return (

js/Signin.js

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ var Signin = React.createClass({
133133
getInitialState: function () {
134134
return {
135135
submitted: null,
136-
success: null
136+
success: null,
137+
successMessage: null
137138
}
138139
},
139140
render: function () {
@@ -142,6 +143,10 @@ var Signin = React.createClass({
142143
message = <div className="alert alert-danger">
143144
<p>{this.state.error}</p>
144145
</div>
146+
} else if (this.state.success && this.state.successMessage != null) {
147+
message = <div className="alert alert-success">
148+
<p>{this.state.successMessage}</p>
149+
</div>
145150
}
146151
return (
147152
<Grid id="main-grid">
@@ -171,15 +176,42 @@ var Signin = React.createClass({
171176
handleSubmit: function () {
172177
if (this.refs.contactForm.isValid()) {
173178
var formData = this.refs.contactForm.getFormData();
174-
auth.login(formData.email, formData.password, (loggedIn) => {
179+
auth.login(formData.email, formData.password, (loggedIn, error) => {
175180
if (loggedIn) {
176181
var target = this.getQuery()["target"];
177182
if (target == null) {
178183
target = '/profile';
179184
}
180185
this.transitionTo(target)
181186
} else {
182-
this.setState({error: "Please try again"});
187+
if (error.non_field_errors == 'User account is disabled.') {
188+
var showSuccess = (() => {this.setState({success: true, successMessage: "Activation email sent."})});
189+
var showFailure = (msg => {this.setState({error: msg})});
190+
var resend_activation = function() {
191+
$.post({
192+
url: config.backend_url + "/accounts/resend-activation/",
193+
data: {email: formData.email},
194+
success: function (data) {
195+
showFailure(data.error);
196+
if (data.success) {
197+
showSuccess()
198+
}
199+
},
200+
error: function (xhr, ajaxOptions, thrownError) {
201+
showFailure('Could not complete this action');
202+
}.bind(this)
203+
});
204+
};
205+
var activation_message =
206+
<span>
207+
This account has not yet been activated. Please check your email for an activation link, or <a href="#" onClick={resend_activation}>resend activation</a>.
208+
</span>
209+
this.setState({error: activation_message});
210+
} else if (error.non_field_errors == 'Unable to login with provided credentials.') {
211+
this.setState({error: "Incorrect email/password"});
212+
} else {
213+
this.setState({error: error.non_field_errors});
214+
}
183215
}
184216
});
185217
} else {

js/VariantTable.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ var research_mode_columns = [
102102

103103
{title: 'Gene Symbol', prop: 'Gene_Symbol'},
104104
{title: 'Genome (GRCh36)', prop: 'Genomic_Coordinate_hg36'},
105-
{title: 'Genome (GRCh37)', prop: 'Genomic_Coordinaty1e_hg37'},
105+
{title: 'Genome (GRCh37)', prop: 'Genomic_Coordinate_hg37'},
106106
{title: 'Genome (GRCh38)', prop: 'Genomic_Coordinate_hg38'},
107107

108108
{title: 'Mutation category (BIC)', prop: 'Mutation_type_BIC'},
@@ -494,7 +494,7 @@ var ResearchVariantTableSupplier = function (Component) {
494494
};
495495

496496
var VariantTableSupplier = function (Component) {
497-
var ResearchVariantTableComponent = React.createClass({
497+
var VariantTableComponent = React.createClass({
498498
mixins: [PureRenderMixin],
499499
getColumns: function () {
500500
return columns;
@@ -518,7 +518,7 @@ var VariantTableSupplier = function (Component) {
518518
);
519519
}
520520
});
521-
return ResearchVariantTableComponent;
521+
return VariantTableComponent;
522522
};
523523

524524

js/auth.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = {
1414
localStorage.token = res.token;
1515
if (cb) cb(true)
1616
} else {
17-
if (cb) cb(false)
17+
if (cb) cb(false, res.error)
1818
}
1919
})
2020
},
@@ -48,9 +48,10 @@ module.exports = {
4848
token: res.token
4949
})
5050
},
51-
error: function () {
51+
error: function (res) {
5252
cb({
53-
authenticated: false
53+
authenticated: false,
54+
error: res.responseJSON
5455
})
5556
}
5657
});

js/config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
module.exports = {
4-
captcha_key: '6LdwNBwTAAAAACFRvttQc08debhGzAzNY0xWQhxw',
4+
captcha_key: '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI',
5+
//backend_url: 'http://brcaexchange.cloudapp.net/backend'
56
backend_url: 'http://localhost:8000'
6-
};
7+
};

0 commit comments

Comments
 (0)