]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git/blobdiff - api/user.go
JS clean.
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git] / api / user.go
index bc24bbb23111d478adb6bb82636cd7bc82dc4e81..8f1a465c10b84c4bb84415012be929284b4ab87e 100644 (file)
@@ -62,7 +62,8 @@ type SignParams struct {
 }
 
 type SignResult struct {
-       Token string `json:"token"`
+       Token   string `json:"token"`
+       IsAdmin bool   `json:"isAdmin"`
 }
 
 func (s SignParams) Validate() *Error {
@@ -135,14 +136,7 @@ func (q SignupQuery) Run() (interface{}, *Error) {
                }
        }
 
-       if CONFIG.FreeSMSUser != "" {
-               err := SendSMS(CONFIG.FreeSMSUser, CONFIG.FreeSMSPass, fmt.Sprintf("'%v' request a password reset. Token '/change-password?token=%v'", q.In.Email, token))
-               if err != nil {
-                       return nil, NewInternalError(err)
-               }
-       }
-
-       return SignResult{token}, nil
+       return SignResult{token, newUser.Role == db.RoleAdmin}, nil
 }
 
 type SigninQuery struct {
@@ -173,7 +167,7 @@ func (q SigninQuery) Run() (interface{}, *Error) {
                return nil, NewInternalError(err)
        }
 
-       return SignResult{token}, nil
+       return SignResult{token, user.Role == db.RoleAdmin}, nil
 }
 
 type ConfirmEmailQuery struct {