mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 03:10:46 -06:00
Trigger browser password manager after sigining up
This commit is contained in:
parent
b874b31b02
commit
b3838c2c1c
@ -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) {
|
||||
|
@ -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'
|
||||
|
3
app/views/users/account_created.html.erb
Normal file
3
app/views/users/account_created.html.erb
Normal file
@ -0,0 +1,3 @@
|
||||
<div id='simple-container'>
|
||||
<span style="font-size: 16px; line-height: 24px;"><%= t 'login.activate_email' %></span>
|
||||
</div>
|
@ -1089,7 +1089,7 @@ en:
|
||||
incorrect_username_email_or_password: "Incorrect username, email or password"
|
||||
wait_approval: "Thanks for signing up. We will notify you when your account has been approved."
|
||||
active: "Your account is activated and ready to use."
|
||||
activate_email: "You're almost done! We sent an activation email to <b>%{email}</b>. Please follow the instructions in the email to activate your account."
|
||||
activate_email: "You're almost done! We sent an activation mail to the email address you provided. Please follow the instructions in the email to activate your account."
|
||||
not_activated: "You can't log in yet. We sent an activation email to you. Please follow the instructions in the email to activate your account."
|
||||
not_allowed_from_ip_address: "You can't login as %{username} from that IP address."
|
||||
suspended: "You can't log in until %{date}."
|
||||
|
@ -201,6 +201,7 @@ Discourse::Application.routes.draw do
|
||||
|
||||
post "users/read-faq" => "users#read_faq"
|
||||
get "users/search/users" => "users#search_users"
|
||||
get "users/account-created/" => "users#account_created"
|
||||
get "users/password-reset/:token" => "users#password_reset"
|
||||
put "users/password-reset/:token" => "users#password_reset"
|
||||
get "users/activate-account/:token" => "users#activate_account"
|
||||
|
@ -52,9 +52,7 @@ test("create account", function() {
|
||||
|
||||
click('.modal-footer .btn-primary');
|
||||
andThen(function() {
|
||||
not(exists('.modal-body'), 'it hides the body when finished');
|
||||
ok(exists('.modal-footer .btn-primary:disabled'), "create account is disabled");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user