forked from forgejo/forgejo
Change /user/profile URL to /user/:username
This commit is contained in:
parent
ba5c7ea771
commit
a2a59f8ad1
11 changed files with 96 additions and 83 deletions
|
@ -190,6 +190,23 @@ func GetUserById(id int64) (*User, error) {
|
|||
return user, nil
|
||||
}
|
||||
|
||||
func GetUserByName(name string) (*User, error) {
|
||||
if len(name) == 0 {
|
||||
return nil, ErrUserNotExist
|
||||
}
|
||||
user := &User{
|
||||
LowerName: strings.ToLower(name),
|
||||
}
|
||||
has, err := orm.Get(user)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !has {
|
||||
return nil, ErrUserNotExist
|
||||
}
|
||||
return user, nil
|
||||
}
|
||||
|
||||
// LoginUserPlain validates user by raw user name and password.
|
||||
func LoginUserPlain(name, passwd string) (*User, error) {
|
||||
user := User{LowerName: strings.ToLower(name), Passwd: passwd}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue