kopia lustrzana https://github.com/reiver/greatape
Porównaj commity
2 Commity
51959fb83e
...
cdf258e158
Autor | SHA1 | Data |
---|---|---|
Xeronith | cdf258e158 | |
Xeronith | 9640fc47a5 |
|
@ -21,6 +21,6 @@ func LoginService(context IContext, input *LoginRequest) (result *LoginResult, e
|
|||
|
||||
result = context.ResultContainer().(*LoginResult)
|
||||
result.Username = commandResult.Username()
|
||||
result.Token = commandResult.Token()
|
||||
result.Token = "Automatic"
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ func SignupService(context IContext, input *SignupRequest) (result *SignupResult
|
|||
context.SetAuthCookie(commandResult.Token())
|
||||
|
||||
result = context.ResultContainer().(*SignupResult)
|
||||
result.Token = commandResult.Token()
|
||||
result.Token = "Automatic"
|
||||
result.Code = commandResult.Code()
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -20,6 +20,6 @@ func VerifyService(context IContext, input *VerifyRequest) (result *VerifyResult
|
|||
context.SetAuthCookie(commandResult.Token())
|
||||
|
||||
result = context.ResultContainer().(*VerifyResult)
|
||||
result.Token = commandResult.Token()
|
||||
result.Token = "Automatic"
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
@ -344,6 +344,10 @@ func (result signupResult) Code() string {
|
|||
//endregion
|
||||
|
||||
func (manager *spiManager) Signup(username string, email string, password string, editor Identity) (result ISignupResult, err error) {
|
||||
username = strings.ToLower(username)
|
||||
|
||||
email = strings.ToLower(email)
|
||||
|
||||
if !validators.UsernameIsValid(username) {
|
||||
return nil, ERROR_INVALID_USERNAME_FOR_SIGNUP
|
||||
}
|
||||
|
@ -362,9 +366,6 @@ func (manager *spiManager) Signup(username string, email string, password string
|
|||
}
|
||||
}()
|
||||
|
||||
username = strings.ToLower(username)
|
||||
email = strings.ToLower(email)
|
||||
|
||||
editor.Lock(SIGNUP_REQUEST)
|
||||
defer editor.Unlock(SIGNUP_REQUEST)
|
||||
|
||||
|
@ -395,6 +396,8 @@ func (result resendVerificationCodeResult) Code() string {
|
|||
//endregion
|
||||
|
||||
func (manager *spiManager) ResendVerificationCode(email string, editor Identity) (result IResendVerificationCodeResult, err error) {
|
||||
email = strings.ToLower(email)
|
||||
|
||||
if !validators.EmailIsValid(email) {
|
||||
return nil, ERROR_INVALID_EMAIL_FOR_RESEND_VERIFICATION_CODE
|
||||
}
|
||||
|
@ -405,8 +408,6 @@ func (manager *spiManager) ResendVerificationCode(email string, editor Identity)
|
|||
}
|
||||
}()
|
||||
|
||||
email = strings.ToLower(email)
|
||||
|
||||
editor.Lock(RESEND_VERIFICATION_CODE_REQUEST)
|
||||
defer editor.Unlock(RESEND_VERIFICATION_CODE_REQUEST)
|
||||
|
||||
|
@ -437,6 +438,8 @@ func (result verifyResult) Token() string {
|
|||
//endregion
|
||||
|
||||
func (manager *spiManager) Verify(email string, token string, code string, editor Identity) (result IVerifyResult, err error) {
|
||||
email = strings.ToLower(email)
|
||||
|
||||
if !validators.EmailIsValid(email) {
|
||||
return nil, ERROR_INVALID_EMAIL_FOR_VERIFY
|
||||
}
|
||||
|
@ -447,8 +450,6 @@ func (manager *spiManager) Verify(email string, token string, code string, edito
|
|||
}
|
||||
}()
|
||||
|
||||
email = strings.ToLower(email)
|
||||
|
||||
editor.Lock(VERIFY_REQUEST)
|
||||
defer editor.Unlock(VERIFY_REQUEST)
|
||||
|
||||
|
@ -485,6 +486,8 @@ func (result loginResult) Token() string {
|
|||
//endregion
|
||||
|
||||
func (manager *spiManager) Login(email string, password string, editor Identity) (result ILoginResult, err error) {
|
||||
email = strings.ToLower(email)
|
||||
|
||||
if !validators.EmailIsValid(email) {
|
||||
return nil, ERROR_INVALID_EMAIL_FOR_LOGIN
|
||||
}
|
||||
|
@ -499,8 +502,6 @@ func (manager *spiManager) Login(email string, password string, editor Identity)
|
|||
}
|
||||
}()
|
||||
|
||||
email = strings.ToLower(email)
|
||||
|
||||
editor.Lock(LOGIN_REQUEST)
|
||||
defer editor.Unlock(LOGIN_REQUEST)
|
||||
|
||||
|
@ -687,14 +688,14 @@ func NewResetPasswordResult(_ interface{}) IResetPasswordResult {
|
|||
//endregion
|
||||
|
||||
func (manager *spiManager) ResetPassword(usernameOrEmail string, editor Identity) (result IResetPasswordResult, err error) {
|
||||
usernameOrEmail = strings.ToLower(usernameOrEmail)
|
||||
|
||||
defer func() {
|
||||
if reason := recover(); reason != nil {
|
||||
err = manager.Error(reason)
|
||||
}
|
||||
}()
|
||||
|
||||
usernameOrEmail = strings.ToLower(usernameOrEmail)
|
||||
|
||||
editor.Lock(RESET_PASSWORD_REQUEST)
|
||||
defer editor.Unlock(RESET_PASSWORD_REQUEST)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue