diff --git a/app/assets/javascripts/discourse/controllers/create_account_controller.js b/app/assets/javascripts/discourse/controllers/create_account_controller.js index 46062c9eb..05e8c3836 100644 --- a/app/assets/javascripts/discourse/controllers/create_account_controller.js +++ b/app/assets/javascripts/discourse/controllers/create_account_controller.js @@ -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() { diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0690c4d28..1cbbf1f87 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/services/user_authenticator.rb b/app/services/user_authenticator.rb index e350dbbeb..8c5adb9d2 100644 --- a/app/services/user_authenticator.rb +++ b/app/services/user_authenticator.rb @@ -13,6 +13,10 @@ class UserAuthenticator end end + def has_authenticator? + !!authenticator + end + def finish if authenticator authenticator.after_create_account(@user, @session)