BUGFIX: twitter auth asking for a password
This commit is contained in:
parent
52fbce07ed
commit
619fa50d4b
|
@ -46,7 +46,7 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
|
|||
}.property('nameValidation.failed', 'emailValidation.failed', 'usernameValidation.failed', 'passwordValidation.failed', 'formSubmitted', 'tosAccepted'),
|
||||
|
||||
passwordRequired: function() {
|
||||
return (this.blank('authOptions.auth_provider') || this.blank('authOptions.email_valid') || !this.get('authOptions.email_valid'));
|
||||
return this.blank('authOptions.auth_provider');
|
||||
}.property('authOptions.auth_provider'),
|
||||
|
||||
passwordInstructions: function() {
|
||||
|
|
|
@ -128,6 +128,10 @@ class UsersController < ApplicationController
|
|||
activation = UserActivator.new(user, request, session, cookies)
|
||||
activation.start
|
||||
|
||||
# just assign a password if we have an authenticator and no password
|
||||
# this is the case for Twitter
|
||||
user.password = SecureRandom.hex if user.password.blank? && authentication.has_authenticator?
|
||||
|
||||
if user.save
|
||||
authentication.finish
|
||||
activation.finish
|
||||
|
|
|
@ -13,6 +13,10 @@ class UserAuthenticator
|
|||
end
|
||||
end
|
||||
|
||||
def has_authenticator?
|
||||
!!authenticator
|
||||
end
|
||||
|
||||
def finish
|
||||
if authenticator
|
||||
authenticator.after_create_account(@user, @session)
|
||||
|
|
Loading…
Reference in New Issue