PLT-4524 Update password reset page (#4522)

* Implement PLT-4524 Update password reset page

* fix lints

* changes based on review

* update per request/review

* update tests

* add css for alert-success

* change per request
This commit is contained in:
Carlos Tadeu Panato Junior
2016-11-17 15:07:16 +01:00
committed by Christopher Speller
parent 6dde2d268a
commit 3d2249edfc
5 changed files with 16 additions and 11 deletions

View File

@@ -1723,7 +1723,7 @@ func sendPasswordReset(c *Context, w http.ResponseWriter, r *http.Request) {
var user *model.User var user *model.User
if result := <-Srv.Store.User().GetByEmail(email); result.Err != nil { if result := <-Srv.Store.User().GetByEmail(email); result.Err != nil {
c.Err = model.NewLocAppError("sendPasswordReset", "api.user.send_password_reset.find.app_error", nil, "email="+email) w.Write([]byte(model.MapToJson(props)))
return return
} else { } else {
user = result.Data.(*model.User) user = result.Data.(*model.User)

View File

@@ -1256,18 +1256,23 @@ func TestSendPasswordReset(t *testing.T) {
LinkUserToTeam(user, team) LinkUserToTeam(user, team)
store.Must(Srv.Store.User().VerifyEmail(user.Id)) store.Must(Srv.Store.User().VerifyEmail(user.Id))
if _, err := Client.SendPasswordReset(user.Email); err != nil { if result, err := Client.SendPasswordReset(user.Email); err != nil {
t.Fatal(err) t.Fatal(err)
} else {
resp := result.Data.(map[string]string)
if resp["email"] != user.Email {
t.Fatal("wrong email")
}
}
if _, err := Client.SendPasswordReset("junk@junk.com"); err != nil {
t.Fatal("Should have errored - bad email")
} }
if _, err := Client.SendPasswordReset(""); err == nil { if _, err := Client.SendPasswordReset(""); err == nil {
t.Fatal("Should have errored - no email") t.Fatal("Should have errored - no email")
} }
if _, err := Client.SendPasswordReset("junk@junk.com"); err == nil {
t.Fatal("Should have errored - bad email")
}
authData := model.NewId() authData := model.NewId()
user2 := &model.User{Email: strings.ToLower(model.NewId()) + "success+test@simulator.amazonses.com", Nickname: "Corey Hulen", AuthData: &authData, AuthService: "random"} user2 := &model.User{Email: strings.ToLower(model.NewId()) + "success+test@simulator.amazonses.com", Nickname: "Corey Hulen", AuthData: &authData, AuthService: "random"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User) user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)

View File

@@ -52,14 +52,14 @@ class PasswordResetSendLink extends React.Component {
<div className='reset-form alert alert-success'> <div className='reset-form alert alert-success'>
<FormattedHTMLMessage <FormattedHTMLMessage
id='password_send.link' id='password_send.link'
defaultMessage='<p>A password reset link has been sent to <b>{email}</b></p>' defaultMessage='If the account exists, a password reset email will be sent to: <br/><b>{email}</b><br/><br/>'
values={{ values={{
email email
}} }}
/> />
<FormattedMessage <FormattedMessage
id={'password_send.checkInbox'} id='password_send.checkInbox'
defaultMessage={'Please check your inbox.'} defaultMessage='Please check your inbox.'
/> />
</div> </div>
) )

View File

@@ -1558,7 +1558,7 @@
"password_send.description": "To reset your password, enter the email address you used to sign up", "password_send.description": "To reset your password, enter the email address you used to sign up",
"password_send.email": "Email", "password_send.email": "Email",
"password_send.error": "Please enter a valid email address.", "password_send.error": "Please enter a valid email address.",
"password_send.link": "<p>A password reset link has been sent to <b>{email}</b></p>", "password_send.link": "If the account exists, a password reset email will be sent to: <br/><b>{email}</b><br/><br/>",
"password_send.reset": "Reset my password", "password_send.reset": "Reset my password",
"password_send.title": "Password Reset", "password_send.title": "Password Reset",
"pdf_preview.max_pages": "Download to read more pages", "pdf_preview.max_pages": "Download to read more pages",

View File

@@ -13,7 +13,7 @@
.signup-team__container { .signup-team__container {
margin: 0 auto; margin: 0 auto;
max-width: 380px; max-width: 400px;
padding: 100px 0 50px; padding: 100px 0 50px;
position: relative; position: relative;