tsk-19: Service login (#23)
Closes #19 Reviewed-on: phoenix/textsender-auth#23 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
@@ -8,12 +8,12 @@ type HashMash struct {
|
||||
Password string
|
||||
}
|
||||
|
||||
func (h HashMash) HashPassword() (string, error) {
|
||||
func (h *HashMash) HashPassword() (string, error) {
|
||||
bytes, err := bcrypt.GenerateFromPassword([]byte(h.Password), bcrypt.DefaultCost)
|
||||
return string(bytes), err
|
||||
}
|
||||
|
||||
func (h HashMash) CheckPasswordHash(password string, hash string) bool {
|
||||
func (h *HashMash) CheckPasswordHash(password string, hash string) bool {
|
||||
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
||||
return err == nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user