1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-25 08:09:43 +02:00

Give missing account warning during password reset

The reset password process will tell the user if they do not have an account.
This commit is contained in:
Harvey Kandola 2019-04-09 13:24:27 +01:00
parent 2ddd7ada9b
commit b5a5cfd697
4 changed files with 24 additions and 6 deletions

View file

@ -18,6 +18,7 @@ import Component from '@ember/component';
export default Component.extend({
email: "",
sayThanks: false,
sayError: false,
emailEmpty: empty('email'),
hasEmptyEmailError: and('emailEmpty', 'emailIsEmpty'),
@ -30,10 +31,16 @@ export default Component.extend({
return $("#email").focus();
}
set(this, 'sayThanks', false);
set(this, 'sayError', false);
set(this, 'emailIsEmpty', false);
this.get('forgot')(email).then(() => {
set(this, 'sayThanks', true);
set(this, 'email', '');
set(this, 'emailIsEmpty', false);
}).catch(() => {
set(this, 'sayError', true);
});
}
}

View file

@ -10,7 +10,6 @@
// https://documize.com
import { isEmpty } from '@ember/utils';
import RSVP from 'rsvp';
import Service, { inject as service } from '@ember/service';

View file

@ -1,13 +1,17 @@
<form {{action "forgot" on="submit"}}>
{{#if sayThanks}}
<div class="reset-thanks margin-bottom-30">Thanks. Check your email for instructions.</div>
<p class="color-green-700 margin-bottom-30">Thanks. Check your email for instructions.</p>
{{else}}
<div class="form-group">
<label for="email">Email</label>
{{focus-input type="email" value=email id="email" class=(if hasEmptyEmailError "form-control is-invalid" "form-control")}}
{{#if sayError}}
<p class="color-red-700 margin-top-10">Email not found</p>
{{/if}}
</div>
{{ui/ui-button color=constants.Color.Yellow light=true label=constants.Label.Reset onClick=(action "forgot")}}
{{/if}}
{{ui/ui-spacer size=400}}
{{#link-to "auth.login"}}Click here to sign in{{/link-to}}
</form>