forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request TryGhost#4602 from jaswilli/better-auth-retry
Allow re-authentication in editor after 401 response
- Loading branch information
Showing
7 changed files
with
94 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import SigninController from 'ghost/controllers/signin'; | ||
|
||
export default SigninController.extend({ | ||
needs: 'application', | ||
|
||
identification: Ember.computed('session.user.email', function () { | ||
return this.get('session.user.email'); | ||
}), | ||
|
||
actions: { | ||
authenticate: function () { | ||
var appController = this.get('controllers.application'), | ||
self = this; | ||
|
||
appController.set('skipAuthSuccessHandler', true); | ||
|
||
this._super().then(function () { | ||
self.send('closeModal'); | ||
self.notifications.showSuccess('Login successful.'); | ||
self.set('password', ''); | ||
}).finally(function () { | ||
appController.set('skipAuthSuccessHandler', undefined); | ||
}); | ||
}, | ||
|
||
confirmAccept: function () { | ||
this.send('validateAndAuthenticate'); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{#gh-modal-dialog action="closeModal" showClose=true type="action" style="wide" animation="fade" | ||
title="Please re-authenticate" confirm=confirm}} | ||
|
||
<form id="login" class="login-form" method="post" novalidate="novalidate" {{action "validateAndAuthenticate" on="submit"}}> | ||
<div class="password-wrap"> | ||
{{input class="password" type="password" placeholder="Password" name="password" value=password}} | ||
</div> | ||
<button class="btn btn-blue" type="submit" {{action "validateAndAuthenticate"}} {{bind-attr disabled=submitting}}>Log in</button> | ||
</form> | ||
|
||
{{/gh-modal-dialog}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters