diff --git a/app/assets/javascripts/discourse/controllers/create-account.js.es6 b/app/assets/javascripts/discourse/controllers/create-account.js.es6 index fe332b153c2..01cab4acf75 100644 --- a/app/assets/javascripts/discourse/controllers/create-account.js.es6 +++ b/app/assets/javascripts/discourse/controllers/create-account.js.es6 @@ -347,8 +347,12 @@ export default DiscourseController.extend(ModalFunctionality, { var challenge = this.get('accountChallenge'); return Discourse.User.createAccount(name, email, password, username, passwordConfirm, challenge).then(function(result) { if (result.success) { - self.flash(result.message); - self.set('complete', true); + // Trigger the browser's password manager using the hidden static login form: + var $hidden_login_form = $('#hidden-login-form'); + $hidden_login_form.find('input[name=username]').val(self.get('accountName')); + $hidden_login_form.find('input[name=password]').val(self.get('accountPassword')); + $hidden_login_form.find('input[name=redirect]').val(Discourse.getURL('/users/account-created')); + $hidden_login_form.submit(); } else { self.flash(result.message || I18n.t('create_account.failed'), 'error'); if (result.errors && result.errors.email && result.errors.email.length > 0 && result.values) { diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0c764f4773e..f7fa076d084 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -6,7 +6,7 @@ require_dependency 'rate_limiter' class UsersController < ApplicationController skip_before_filter :authorize_mini_profiler, only: [:avatar] - skip_before_filter :check_xhr, only: [:show, :password_reset, :update, :activate_account, :perform_account_activation, :authorize_email, :user_preferences_redirect, :avatar, :my_redirect] + skip_before_filter :check_xhr, only: [:show, :password_reset, :update, :account_created, :activate_account, :perform_account_activation, :authorize_email, :user_preferences_redirect, :avatar, :my_redirect] before_filter :ensure_logged_in, only: [:username, :update, :change_email, :user_preferences_redirect, :upload_user_image, :pick_avatar, :destroy_user_image, :destroy] before_filter :respond_to_suspicious_request, only: [:create] @@ -18,6 +18,7 @@ class UsersController < ApplicationController skip_before_filter :redirect_to_login_if_required, only: [:check_username, :create, :get_honeypot_value, + :account_created, :activate_account, :perform_account_activation, :send_activation_email, @@ -295,6 +296,11 @@ class UsersController < ApplicationController render layout: 'no_js' end + def account_created + expires_now + render layout: 'no_js' + end + def activate_account expires_now render layout: 'no_js' diff --git a/app/views/users/account_created.html.erb b/app/views/users/account_created.html.erb new file mode 100644 index 00000000000..ce13d4f1427 --- /dev/null +++ b/app/views/users/account_created.html.erb @@ -0,0 +1,3 @@ +