- Refactor ActiveEntry.sigIn method
- Add own Reset password template - Check password history and validation in Reset Password - Add expireTimeInMinute in passwordOptions to control expire time of reset link - Show sending notification while reset link is sent
This commit is contained in:
1 parent
7fa4c33064
commit
1e1c4033a6
8 files changed
+367
-238
No files matched your search
@@ -28,45 +28,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="resetPassword">
|
||||
{{#if resetPassword}}
|
||||
<div id="resetPassword" class="page entryPage" style="{{getOpacityWithCorner}}">
|
||||
<div class="content-scrollable">
|
||||
<div class="wrapper-auth">
|
||||
<div class="entryLogo" style="background-image: url('{{getLogoUrl}}')"></div>
|
||||
|
||||
<h1 id="signInPageTitle" class="title-auth">Reset Password</h1>
|
||||
<div id="signInPageMessage" class="subtitle-auth" >Improve your clinical practice with checklists.</div>
|
||||
|
||||
<form>
|
||||
{{#if resetPasswordErrorMessages}}
|
||||
<div id="errorMessages" class="list-errors">
|
||||
{{#each resetPasswordErrorMessages}}
|
||||
<div class="alert alert-danger list-item">{{this}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="input-symbol ">
|
||||
<input id="resetPasswordInput" type="password" name="password" placeholder="Password" style="{{getPasswordStyling}}" />
|
||||
<span class="fa fa-lock" title="Password"></span>
|
||||
<!-- <span class="icon-lock" title="Password"></span> -->
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div class="input-symbol">
|
||||
<input id="resetPasswordConfirmInput" type="password" name="confirm" placeholder="Confirm Password" style="{{getConfirmPasswordStyling}}" />
|
||||
<span class="fa fa-lock" title="Confirm Password"></span>
|
||||
<!-- <span class="icon-lock" title="Confirm Password"></span> -->
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
</form>
|
||||
<button id="resetPasswordButton" type="submit" class="btn-gray btn-main btn-large" style="{{getButtonColor}}">Reset Password</button><br><br>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
@@ -5,16 +5,6 @@ Router.route('/forgotPassword', {
|
||||
template: "forgotPassword"
|
||||
});
|
||||
|
||||
Router.route('/resetPassword/:token', {
|
||||
template: 'resetPassword',
|
||||
name: 'resetPassword',
|
||||
onBeforeAction: function() {
|
||||
var token = this.params.token;
|
||||
Session.set('_resetPasswordToken', token);
|
||||
this.next();
|
||||
}
|
||||
});
|
||||
|
||||
Template.forgotPassword.helpers({
|
||||
getForgotPasswordMessageColor: function (){
|
||||
if (ActiveEntry.errorMessages.get('forgotPassword')) {
|
||||
@@ -37,48 +27,10 @@ Template.forgotPassword.helpers({
|
||||
Template.forgotPassword.events({
|
||||
"submit": function (event, template) {
|
||||
event.preventDefault();
|
||||
|
||||
console.log('send reminder!');
|
||||
ActiveEntry.successMessages.set("forgotPassword", "Your password reset email is sending...");
|
||||
var emailAddress = $('#signInPageEmailInput').val();
|
||||
ActiveEntry.forgotPassword(emailAddress);
|
||||
}
|
||||
});
|
||||
|
||||
// Reset password template
|
||||
Template.resetPassword.helpers({
|
||||
resetPassword: function(){
|
||||
return Session.get('_resetPasswordToken');
|
||||
},
|
||||
resetPasswordErrorMessages: function() {
|
||||
if (ActiveEntry.errorMessages.get("password")) {
|
||||
return [ActiveEntry.errorMessages.get("password")];
|
||||
}
|
||||
if (ActiveEntry.errorMessages.get("confirm")) {
|
||||
return [ActiveEntry.errorMessages.get("confirm")];
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Template.resetPassword.events({
|
||||
'keyup #resetPasswordInput': function (event, template) {
|
||||
var password = $('#resetPasswordInput').val();
|
||||
ActiveEntry.verifyPassword(password);
|
||||
ActiveEntry.errorMessages.set('forgotPassword', null);
|
||||
},
|
||||
'keyup #resetPasswordConfirmInput': function (event, template) {
|
||||
|
||||
var password = $('#resetPasswordInput').val();
|
||||
var confirmPassword = $('#resetPasswordConfirmInput').val();
|
||||
|
||||
ActiveEntry.verifyConfirmPassword(password, confirmPassword);
|
||||
ActiveEntry.errorMessages.set('forgotPassword', null);
|
||||
},
|
||||
'click #resetPasswordButton': function(e, template) {
|
||||
e.preventDefault();
|
||||
var password = $('#resetPasswordInput').val();
|
||||
var passwordConfirm = $('#resetPasswordConfirmInput').val();
|
||||
ActiveEntry.resetPassword(password, passwordConfirm);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user