"github.com/dchest/passwordreset"
"github.com/gin-gonic/gin"
- "immae.eu/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front/db"
+ "git.immae.eu/Cryptoportfolio/Front.git/db"
)
const (
}
type SignResult struct {
- Token string `json:"token"`
+ Token string `json:"token"`
+ IsAdmin bool `json:"isAdmin"`
}
func (s SignParams) Validate() *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 {
return nil, NewInternalError(err)
}
- return SignResult{token}, nil
+ return SignResult{token, user.Role == db.RoleAdmin}, nil
}
type ConfirmEmailQuery struct {