mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
a258e3d881
issue TryGhost/Ghost#7452, requires TryGhost/Ghost#7451 - use a `ghostOAuth` config flag to switch between the old-style per-install auth and centralized OAuth auth based on config provided by the server - add OAuth flows for: - setup - sign-in - sign-up - re-authenticate - add custom `oauth-ghost` authenticator to support our custom data structure - add test helpers to stub successful/failed oauth authentication - hide change password form if using OAuth (temporary - a way to change password via oauth provider will be added later)
26 lines
837 B
JavaScript
26 lines
837 B
JavaScript
import NewUserValidator from 'ghost-admin/validators/new-user';
|
|
|
|
export default NewUserValidator.create({
|
|
properties: ['name', 'email', 'password', 'blogTitle', 'session'],
|
|
|
|
blogTitle(model) {
|
|
let blogTitle = model.get('blogTitle');
|
|
|
|
if (!validator.isLength(blogTitle, 1)) {
|
|
model.get('errors').add('blogTitle', 'Please enter a blog title.');
|
|
this.invalidate();
|
|
}
|
|
},
|
|
|
|
session(model) {
|
|
let usingOAuth = model.get('config.ghostOAuth');
|
|
let isAuthenticated = model.get('session.isAuthenticated');
|
|
|
|
if (usingOAuth && !isAuthenticated) {
|
|
model.get('errors').add('session', 'Please connect a Ghost.org account before continuing');
|
|
model.get('hasValidated').pushObject('session');
|
|
this.invalidate();
|
|
}
|
|
}
|
|
});
|