mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 22:12:07 +08:00
FIX: invited users get clearer messaging when setting a password for the first time
This commit is contained in:
parent
3c3449aa1b
commit
ba74226346
|
@ -43,7 +43,14 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">{{i18n user.password.title}}</label>
|
<label class="control-label">{{i18n user.password.title}}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<a href="#" {{action changePassword}} class='btn'><i class="fa fa-envelope"></i>{{i18n user.change_password.action}}</a> {{passwordProgress}}
|
<a href="#" {{action changePassword}} class='btn'><i class="fa fa-envelope"></i>
|
||||||
|
{{#if no_password}}
|
||||||
|
{{i18n user.change_password.set_password}}
|
||||||
|
{{else}}
|
||||||
|
{{i18n user.change_password.action}}
|
||||||
|
{{/if}}
|
||||||
|
</a>
|
||||||
|
{{passwordProgress}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,9 @@ class UserNotifications < ActionMailer::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def forgot_password(user, opts={})
|
def forgot_password(user, opts={})
|
||||||
build_email(user.email, template: "user_notifications.forgot_password", email_token: opts[:email_token])
|
build_email( user.email,
|
||||||
|
template: user.has_password? ? "user_notifications.forgot_password" : "user_notifications.set_password",
|
||||||
|
email_token: opts[:email_token])
|
||||||
end
|
end
|
||||||
|
|
||||||
def digest(user, opts={})
|
def digest(user, opts={})
|
||||||
|
|
|
@ -260,6 +260,10 @@ class User < ActiveRecord::Base
|
||||||
!!@password_required
|
!!@password_required
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_password?
|
||||||
|
password_hash.present?
|
||||||
|
end
|
||||||
|
|
||||||
def password_validator
|
def password_validator
|
||||||
PasswordValidator.new(attributes: :password).validate_each(self, :password, @raw_password)
|
PasswordValidator.new(attributes: :password).validate_each(self, :password, @raw_password)
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,8 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||||
:dynamic_favicon,
|
:dynamic_favicon,
|
||||||
:trust_level,
|
:trust_level,
|
||||||
:can_edit,
|
:can_edit,
|
||||||
:can_invite_to_forum
|
:can_invite_to_forum,
|
||||||
|
:no_password
|
||||||
|
|
||||||
def include_site_flagged_posts_count?
|
def include_site_flagged_posts_count?
|
||||||
object.staff?
|
object.staff?
|
||||||
|
@ -45,4 +46,12 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||||
scope.can_invite_to_forum?
|
scope.can_invite_to_forum?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def no_password
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
def include_no_password?
|
||||||
|
!object.has_password?
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,14 +23,20 @@
|
||||||
</p>
|
</p>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%if @user.present? %>
|
<%if @user.present? %>
|
||||||
<h3><%= t 'password_reset.choose_new' %></h3>
|
<h3>
|
||||||
|
<% if @user.has_password? %>
|
||||||
|
<%= t 'password_reset.choose_new' %>
|
||||||
|
<% else %>
|
||||||
|
<%= t 'password_reset.choose' %>
|
||||||
|
<% end %>
|
||||||
|
</h3>
|
||||||
|
|
||||||
<%=form_tag({}, method: :put) do %>
|
<%=form_tag({}, method: :put) do %>
|
||||||
<p>
|
<p>
|
||||||
<input id="user_password" name="password" size="30" type="password">
|
<input id="user_password" name="password" size="30" type="password">
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<%=submit_tag(t('password_reset.update'), class: 'btn')%>
|
<%=submit_tag( @user.has_password? ? t('password_reset.update') : t('password_reset.save'), class: 'btn')%>
|
||||||
</p>
|
</p>
|
||||||
<%end%>
|
<%end%>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
|
@ -246,6 +246,7 @@ en:
|
||||||
in_progress: "(sending email)"
|
in_progress: "(sending email)"
|
||||||
error: "(error)"
|
error: "(error)"
|
||||||
action: "Send Password Reset Email"
|
action: "Send Password Reset Email"
|
||||||
|
set_password: "Set Password"
|
||||||
|
|
||||||
change_about:
|
change_about:
|
||||||
title: "Change About Me"
|
title: "Change About Me"
|
||||||
|
|
|
@ -300,8 +300,10 @@ en:
|
||||||
password_reset:
|
password_reset:
|
||||||
no_token: "Sorry, your token has expired. Please try resetting your password again."
|
no_token: "Sorry, your token has expired. Please try resetting your password again."
|
||||||
choose_new: "Please choose a new password"
|
choose_new: "Please choose a new password"
|
||||||
update: 'update password'
|
choose: "Please choose a password"
|
||||||
title: 'reset password'
|
update: 'Update Password'
|
||||||
|
save: 'Set Password'
|
||||||
|
title: 'Reset Password'
|
||||||
success: "You successfully changed your password and are now logged in."
|
success: "You successfully changed your password and are now logged in."
|
||||||
success_unapproved: "You successfully changed your password."
|
success_unapproved: "You successfully changed your password."
|
||||||
continue: "Continue to %{site_name}"
|
continue: "Continue to %{site_name}"
|
||||||
|
@ -1218,6 +1220,16 @@ en:
|
||||||
Click the following link to choose a new password:
|
Click the following link to choose a new password:
|
||||||
%{base_url}/users/password-reset/%{email_token}
|
%{base_url}/users/password-reset/%{email_token}
|
||||||
|
|
||||||
|
set_password:
|
||||||
|
subject_template: "[%{site_name}] Set Password"
|
||||||
|
text_body_template: |
|
||||||
|
Somebody asked to add a password to your account on [%{site_name}](%{base_url}). Alternatively, you can log in using any supported online service (Google, Facebook, etc) that is associated with this validated email address.
|
||||||
|
|
||||||
|
If you did not make this request, you can safely ignore this email.
|
||||||
|
|
||||||
|
Click the following link to choose a password:
|
||||||
|
%{base_url}/users/password-reset/%{email_token}
|
||||||
|
|
||||||
authorize_email:
|
authorize_email:
|
||||||
subject_template: "[%{site_name}] Confirm your new email address"
|
subject_template: "[%{site_name}] Confirm your new email address"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
|
Loading…
Reference in New Issue
Block a user