1

Is it possible to only check the password with ember-simple-auth? I want the user to re-enter their password if they want to delete their account. Can this password check be done without touching the store using ember-simple-auth?

If I use code similar to this:

let loginPromise =
    session.authenticate('authenticator:jwt', { identification, password })
return loginPromise.then(() => true).catch(() => false) // allow/deny to delete the account

then the session is invalidated if the password is wrong, so the user is signed out. I want, however, to only disable the "Delete Account" button if the password is wrong (without any other side effects like signing in).

eugenk
  • 472
  • 4
  • 11
  • Were you able to solve this case? I am stuck with the same issue for confirmation before changing password – krozaine Jul 01 '17 at 09:25
  • For now, I am settling for storing the plain text password in `session.data.authenticated.password` after login and comparing it with this when required. If anyone is having better solutions, please let me know. – krozaine Jul 01 '17 at 11:46
  • No, I wasn't able to really solve this problem. I circumvented it by sending the POST request for a login manually with jQuery. Not elegant at all, but it works. – eugenk Jul 02 '17 at 10:29
  • For reference (app/services/authenticated-user.js): `Ember.Service.extend({ ajax: Ember.inject.service(); validatePassword(username, password) { return this.get('ajax').post(`${ENV.host}/users/sign_in`, { data: { user: { name: username, password: password } } }) } ... }) ` – eugenk Jul 02 '17 at 10:31

0 Answers0