-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #4993 - brings password protection to the frontend of blogs - adds testing for password protection - upgrades bcrypt-js to 2.1.0
- Loading branch information
Showing
24 changed files
with
696 additions
and
9 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
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,27 @@ | ||
import Ember from 'ember'; | ||
|
||
var SettingsPassProtectController = Ember.Controller.extend({ | ||
|
||
actions: { | ||
save: function () { | ||
var self = this; | ||
if (this.get('model.isPrivate') && this.get('model.password') === '') { | ||
self.notifications.closePassive(); | ||
self.notifications.showError('Password must have a value.'); | ||
return; | ||
} | ||
|
||
return this.get('model').save().then(function (model) { | ||
self.notifications.closePassive(); | ||
self.notifications.showSuccess('Settings successfully saved.'); | ||
|
||
return model; | ||
}).catch(function (errors) { | ||
self.notifications.closePassive(); | ||
self.notifications.showErrors(errors); | ||
}); | ||
} | ||
} | ||
}); | ||
|
||
export default SettingsPassProtectController; |
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,44 @@ | ||
import AuthenticatedRoute from 'ghost/routes/authenticated'; | ||
import loadingIndicator from 'ghost/mixins/loading-indicator'; | ||
import CurrentUserSettings from 'ghost/mixins/current-user-settings'; | ||
import styleBody from 'ghost/mixins/style-body'; | ||
|
||
var SettingsPassProtectRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, CurrentUserSettings, { | ||
classNames: ['settings-view-pass'], | ||
|
||
beforeModel: function () { | ||
var feature = this.controllerFor('feature'), | ||
self = this; | ||
|
||
if (!feature) { | ||
this.generateController('feature'); | ||
feature = this.controllerFor('feature'); | ||
} | ||
|
||
return this.get('session.user') | ||
.then(this.transitionAuthor()) | ||
.then(this.transitionEditor()) | ||
.then(function () { | ||
return feature.then(function () { | ||
if (!feature.get('passProtectUI')) { | ||
return self.transitionTo('settings.general'); | ||
} | ||
}); | ||
}); | ||
}, | ||
|
||
model: function () { | ||
return this.store.find('setting', {type: 'blog,theme'}).then(function (records) { | ||
return records.get('firstObject'); | ||
}); | ||
}, | ||
|
||
actions: { | ||
save: function () { | ||
this.get('controller').send('save'); | ||
} | ||
} | ||
|
||
}); | ||
|
||
export default SettingsPassProtectRoute; |
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,29 @@ | ||
<header class="settings-view-header"> | ||
{{#link-to "settings" class="btn btn-default btn-back"}}Back{{/link-to}} | ||
<h2 class="page-title">Password protect your blog</h2> | ||
<section class="page-actions"> | ||
<button type="button" class="btn btn-blue" {{action "save"}}>Save</button> | ||
</section> | ||
</header> | ||
|
||
<section class="content settings-pass"> | ||
<form id="settings-pass" novalidate="novalidate"> | ||
<fieldset> | ||
<div class="form-group for-checkbox"> | ||
<label for="blog-isPrivate">Make this blog private</label> | ||
<label class="checkbox" for="blog-isPrivate"> | ||
{{input id="blog-isPrivate" name="labs[passProtectUI]" type="checkbox" | ||
checked=model.isPrivate}} | ||
<span class="input-toggle-component"></span> | ||
<p>Enable password protection</p> | ||
</label> | ||
</div> | ||
{{#if model.isPrivate}} | ||
<div class="form-group"> | ||
{{input name="private[password]" type="text" value=model.password}} | ||
<p>This password will be needed to access your blog. All search engine optimization and social features are now disabled.</p> | ||
</div> | ||
{{/if}} | ||
</fieldset> | ||
</form> | ||
</section> |
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,5 @@ | ||
import BaseView from 'ghost/views/settings/content-base'; | ||
|
||
var SettingsGeneralView = BaseView.extend(); | ||
|
||
export default SettingsGeneralView; |
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
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
Oops, something went wrong.