remove unnecessary var

Remove createdWithPass var in account.go along with impossible if statement
This commit is contained in:
Colin Axner 2020-09-25 16:07:30 +02:00
parent 7c1244e6b1
commit 75a79d49bd
1 changed files with 1 additions and 6 deletions

View File

@ -151,8 +151,6 @@ func signupWithRegistration(app *App, signup userRegistration, w http.ResponseWr
} }
// Handle empty optional params // Handle empty optional params
// TODO: remove this var
createdWithPass := true
hashedPass, err := auth.HashPass([]byte(signup.Pass)) hashedPass, err := auth.HashPass([]byte(signup.Pass))
if err != nil { if err != nil {
return nil, impart.HTTPError{http.StatusInternalServerError, "Could not create password hash."} return nil, impart.HTTPError{http.StatusInternalServerError, "Could not create password hash."}
@ -162,7 +160,7 @@ func signupWithRegistration(app *App, signup userRegistration, w http.ResponseWr
u := &User{ u := &User{
Username: signup.Alias, Username: signup.Alias,
HashedPass: hashedPass, HashedPass: hashedPass,
HasPass: createdWithPass, HasPass: true,
Email: prepareUserEmail(signup.Email, app.keys.EmailKey), Email: prepareUserEmail(signup.Email, app.keys.EmailKey),
Created: time.Now().Truncate(time.Second).UTC(), Created: time.Now().Truncate(time.Second).UTC(),
} }
@ -188,9 +186,6 @@ func signupWithRegistration(app *App, signup userRegistration, w http.ResponseWr
resUser := &AuthUser{ resUser := &AuthUser{
User: u, User: u,
} }
if !createdWithPass {
resUser.Password = signup.Pass
}
title := signup.Alias title := signup.Alias
if signup.Normalize { if signup.Normalize {
title = desiredUsername title = desiredUsername