|
|
@@ -3,6 +3,7 @@ package user
|
|
|
import (
|
|
|
"fmt"
|
|
|
"gitote/gitote/models"
|
|
|
+ "gitote/gitote/models/errors"
|
|
|
"gitote/gitote/pkg/context"
|
|
|
"gitote/gitote/pkg/setting"
|
|
|
"gitote/gitote/pkg/tool"
|
|
|
@@ -122,3 +123,12 @@ func Action(c *context.Context, puser *context.ParamsUser) {
|
|
|
}
|
|
|
c.Redirect(redirectTo)
|
|
|
}
|
|
|
+
|
|
|
+func GetUserByName(c *context.Context, name string) *models.User {
|
|
|
+ user, err := models.GetUserByName(name)
|
|
|
+ if err != nil {
|
|
|
+ c.NotFoundOrServerError("GetUserByName", errors.IsUserNotExist, err)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return user
|
|
|
+}
|