mirror of
https://github.com/flarum/framework.git
synced 2025-06-04 06:44:33 +08:00
Auth token and avatarUrl security improvements (#1514)
* Remove AbstractOAuth2Controller There is no reason to provide an implementation for a specific oAuth2 library in core; it's not generic enough (eg. auth-twitter can't use it). This code could be moved into another package which auth extensions depend on, but it's a negligible amount of relatively simple code that I don't think it's worth the trouble. * Introduce login providers Users can have many login providers (a combination of a provider name and an identifier for that user, eg. their Facebook ID). After retrieving user data from a provider (eg. Facebook), you pass the login provider details into the Auth\ResponseFactory. If an associated user is found, a response that logs them in will be returned. If not, a registration token will be created so the user can proceed to sign up. Once the token is fulfilled, the login provider will be associated with the user.
This commit is contained in:
@ -148,17 +148,16 @@ export default class ForumApplication extends Application {
|
||||
* with the provided details.
|
||||
*
|
||||
* @param {Object} payload A dictionary of props to pass into the sign up
|
||||
* modal. A truthy `authenticated` prop indicates that the user has logged
|
||||
* modal. A truthy `loggedIn` prop indicates that the user has logged
|
||||
* in, and thus the page is reloaded.
|
||||
* @public
|
||||
*/
|
||||
authenticationComplete(payload) {
|
||||
if (payload.authenticated) {
|
||||
if (payload.loggedIn) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
const modal = new SignUpModal(payload);
|
||||
this.modal.show(modal);
|
||||
modal.$('[name=password]').focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ export default class SignUpModal extends Modal {
|
||||
}
|
||||
|
||||
className() {
|
||||
return 'Modal--small SignUpModal' + (this.welcomeUser ? ' SignUpModal--success' : '');
|
||||
return 'Modal--small SignUpModal';
|
||||
}
|
||||
|
||||
title() {
|
||||
@ -61,7 +61,7 @@ export default class SignUpModal extends Modal {
|
||||
}
|
||||
|
||||
isProvided(field) {
|
||||
return this.props.identificationFields && this.props.identificationFields.indexOf(field) !== -1;
|
||||
return this.props.provided && this.props.provided.indexOf(field) !== -1;
|
||||
}
|
||||
|
||||
body() {
|
||||
@ -179,10 +179,6 @@ export default class SignUpModal extends Modal {
|
||||
data.password = this.password();
|
||||
}
|
||||
|
||||
if (this.props.avatarUrl) {
|
||||
data.avatarUrl = this.props.avatarUrl;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user