connected remotegameprivate and backend
This commit is contained in:
26
server/login.go
Normal file
26
server/login.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/Akilan1999/remotegameplay/server/auth"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func AuthLogin(db *gorm.DB, user *Users) (string, error) {
|
||||
// Generate Hash from password
|
||||
password, err := auth.HashPassword(user.Password)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
match, err := CheckIfEmailAndPasswordMatch(db, user.EmailID, password)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if match == "success" {
|
||||
return "success", nil
|
||||
}
|
||||
|
||||
return "", errors.New("Something is wrong with from our side. Email us: me@akilan.io to find out more. ")
|
||||
}
|
||||
Reference in New Issue
Block a user