diff --git a/controllers/account.go b/controllers/account.go index 0fb6d4e5..ce293f6e 100644 --- a/controllers/account.go +++ b/controllers/account.go @@ -64,7 +64,7 @@ func (c *ApiController) Register() { var resp Response if c.GetSessionUser() != "" { - resp = Response{Status: "error", Msg: "please log out first before signing up", Data: c.GetSessionUser()} + resp = Response{Status: "error", Msg: "Please log out first before signing up", Data: c.GetSessionUser()} c.Data["json"] = resp c.ServeJSON() return @@ -95,7 +95,7 @@ func (c *ApiController) Register() { //c.SetSessionUser(user) util.LogInfo(c.Ctx, "API: [%s] is registered as new user", user) - resp = Response{Status: "ok", Msg: "注册成功", Data: user} + resp = Response{Status: "ok", Msg: "", Data: user} } c.Data["json"] = resp @@ -124,7 +124,7 @@ func (c *ApiController) GetAccount() { var resp Response if c.GetSessionUser() == "" { - resp = Response{Status: "error", Msg: "please sign in first", Data: c.GetSessionUser()} + resp = Response{Status: "error", Msg: "Please sign in first", Data: c.GetSessionUser()} c.Data["json"] = resp c.ServeJSON() return @@ -145,7 +145,7 @@ func (c *ApiController) UploadAvatar() { msg := object.CheckUserLogin(userObj.Owner+"/"+userObj.Name, c.Ctx.Request.Form.Get("password")) if msg != "" { - resp = Response{Status: "error", Msg: "Password wrong"} + resp = Response{Status: "error", Msg: "Wrong password"} c.Data["json"] = resp c.ServeJSON() return diff --git a/controllers/auth.go b/controllers/auth.go index 2f891764..5bfac87c 100644 --- a/controllers/auth.go +++ b/controllers/auth.go @@ -48,7 +48,7 @@ func (c *ApiController) HandleLoggedIn(userId string, form *RequestForm) *Respon code := object.GetOAuthCode(userId, clientId, responseType, redirectUri, scope, state) resp = codeToResponse(code) } else { - resp = &Response{Status: "error", Msg: fmt.Sprintf("unknown response type: %s", form.Type)} + resp = &Response{Status: "error", Msg: fmt.Sprintf("Unknown response type: %s", form.Type)} } return resp } @@ -83,7 +83,7 @@ func (c *ApiController) Login() { if form.Username != "" { if form.Type == ResponseTypeLogin { if c.GetSessionUser() != "" { - resp = &Response{Status: "error", Msg: "please log out first before signing in", Data: c.GetSessionUser()} + resp = &Response{Status: "error", Msg: "Please log out first before signing in", Data: c.GetSessionUser()} c.Data["json"] = resp c.ServeJSON() return @@ -123,7 +123,7 @@ func (c *ApiController) Login() { } if !token.Valid() { - resp = &Response{Status: "error", Msg: "invalid token"} + resp = &Response{Status: "error", Msg: "Invalid token"} c.Data["json"] = resp c.ServeJSON() return @@ -131,7 +131,7 @@ func (c *ApiController) Login() { userInfo, err := idProvider.GetUserInfo(token) if err != nil { - resp = &Response{Status: "error", Msg: "login failed, please try again."} + resp = &Response{Status: "error", Msg: fmt.Sprintf("Failed to login in: %s", err.Error())} c.Data["json"] = resp c.ServeJSON() return @@ -159,12 +159,12 @@ func (c *ApiController) Login() { //} if !application.EnableSignUp { - resp = &Response{Status: "error", Msg: fmt.Sprintf("the account for provider: %s and username: %s does not exist and is not allowed to register as new account, please contact your IT support", provider.Type, userInfo.Username)} + resp = &Response{Status: "error", Msg: fmt.Sprintf("The account for provider: %s and username: %s does not exist and is not allowed to register as new account, please contact your IT support", provider.Type, userInfo.Username)} c.Data["json"] = resp c.ServeJSON() return } else { - resp = &Response{Status: "error", Msg: fmt.Sprintf("the account for provider: %s and username: %s does not exist, please register an account first", provider.Type, userInfo.Username)} + resp = &Response{Status: "error", Msg: fmt.Sprintf("The account for provider: %s and username: %s does not exist, please register an account first", provider.Type, userInfo.Username)} c.Data["json"] = resp c.ServeJSON() return @@ -174,7 +174,7 @@ func (c *ApiController) Login() { } else { userId := c.GetSessionUser() if userId == "" { - resp = &Response{Status: "error", Msg: "user doesn't exist", Data: userInfo} + resp = &Response{Status: "error", Msg: "The account does not exist", Data: userInfo} c.Data["json"] = resp c.ServeJSON() return @@ -184,7 +184,7 @@ func (c *ApiController) Login() { if isLinked { resp = &Response{Status: "ok", Msg: "", Data: isLinked} } else { - resp = &Response{Status: "error", Msg: "link account failed", Data: isLinked} + resp = &Response{Status: "error", Msg: "Failed to link user account", Data: isLinked} } //if len(object.GetMemberAvatar(userId)) == 0 { // avatar := UploadAvatarToOSS(tempUserAccount.AvatarUrl, userId) diff --git a/controllers/base.go b/controllers/base.go index d26f4fc4..ad0c5e40 100644 --- a/controllers/base.go +++ b/controllers/base.go @@ -35,8 +35,8 @@ func (c *ApiController) SetSessionUser(user string) { func wrapActionResponse(affected bool) *Response { if affected { - return &Response{Status: "ok", Msg: "", Data: "affected"} + return &Response{Status: "ok", Msg: "", Data: "Affected"} } else { - return &Response{Status: "ok", Msg: "", Data: "unaffected"} + return &Response{Status: "ok", Msg: "", Data: "Unaffected"} } } diff --git a/object/token.go b/object/token.go index 9544575c..a6495348 100644 --- a/object/token.go +++ b/object/token.go @@ -129,7 +129,7 @@ func CheckOAuthLogin(clientId string, responseType string, redirectUri string, s application := getApplicationByClientId(clientId) if application == nil { - return "invalid client_id", nil + return "Invalid client_id", nil } validUri := false @@ -150,7 +150,7 @@ func GetOAuthCode(userId string, clientId string, responseType string, redirectU user := GetUser(userId) if user == nil { return &Code{ - Message: "invalid user_id", + Message: "Invalid user_id", Code: "", } } @@ -191,7 +191,7 @@ func GetOAuthToken(grantType string, clientId string, clientSecret string, code application := getApplicationByClientId(clientId) if application == nil { return &TokenWrapper{ - AccessToken: "invalid client_id", + AccessToken: "Invalid client_id", TokenType: "", ExpiresIn: 0, Scope: "", @@ -210,7 +210,7 @@ func GetOAuthToken(grantType string, clientId string, clientSecret string, code token := getTokenByCode(code) if token == nil { return &TokenWrapper{ - AccessToken: "invalid code", + AccessToken: "Invalid code", TokenType: "", ExpiresIn: 0, Scope: "", @@ -219,7 +219,7 @@ func GetOAuthToken(grantType string, clientId string, clientSecret string, code if application.Name != token.Application { return &TokenWrapper{ - AccessToken: "token is for wrong application (client_id)", + AccessToken: "The token is for wrong application (client_id)", TokenType: "", ExpiresIn: 0, Scope: "", @@ -228,7 +228,7 @@ func GetOAuthToken(grantType string, clientId string, clientSecret string, code if application.ClientSecret != clientSecret { return &TokenWrapper{ - AccessToken: "invalid client_secret", + AccessToken: "Invalid client_secret", TokenType: "", ExpiresIn: 0, Scope: "", diff --git a/routers/authz_filter.go b/routers/authz_filter.go index 82e38947..299c5d35 100644 --- a/routers/authz_filter.go +++ b/routers/authz_filter.go @@ -93,7 +93,7 @@ func getObject(ctx *context.Context) (string, string) { func denyRequest(ctx *context.Context) { w := ctx.ResponseWriter w.WriteHeader(403) - resp := &controllers.Response{Status: "error", Msg: "unauthorized operation"} + resp := &controllers.Response{Status: "error", Msg: "Unauthorized operation"} _, err := w.Write([]byte(util.StructToJson(resp))) if err != nil { panic(err) diff --git a/web/src/ApplicationEditPage.js b/web/src/ApplicationEditPage.js index 11bd410d..936d36ab 100644 --- a/web/src/ApplicationEditPage.js +++ b/web/src/ApplicationEditPage.js @@ -289,7 +289,7 @@ class ApplicationEditPage extends React.Component { } }) .catch(error => { - Setting.showMessage("error", `failed to connect to server: ${error}`); + Setting.showMessage("error", `Failed to connect to server: ${error}`); }); } diff --git a/web/src/OrganizationEditPage.js b/web/src/OrganizationEditPage.js index 9b9d8f89..44146cda 100644 --- a/web/src/OrganizationEditPage.js +++ b/web/src/OrganizationEditPage.js @@ -116,7 +116,7 @@ class OrganizationEditPage extends React.Component { } }) .catch(error => { - Setting.showMessage("error", `failed to connect to server: ${error}`); + Setting.showMessage("error", `Failed to connect to server: ${error}`); }); } diff --git a/web/src/ProviderEditPage.js b/web/src/ProviderEditPage.js index 20232276..1d5db221 100644 --- a/web/src/ProviderEditPage.js +++ b/web/src/ProviderEditPage.js @@ -155,7 +155,7 @@ class ProviderEditPage extends React.Component { } }) .catch(error => { - Setting.showMessage("error", `failed to connect to server: ${error}`); + Setting.showMessage("error", `Failed to connect to server: ${error}`); }); } diff --git a/web/src/UserEditPage.js b/web/src/UserEditPage.js index 79751b0b..0b7c235d 100644 --- a/web/src/UserEditPage.js +++ b/web/src/UserEditPage.js @@ -283,7 +283,7 @@ class UserEditPage extends React.Component { } }) .catch(error => { - Setting.showMessage("error", `failed to connect to server: ${error}`); + Setting.showMessage("error", `Failed to connect to server: ${error}`); }); } diff --git a/web/src/auth/AuthCallback.js b/web/src/auth/AuthCallback.js index f5f318f3..6428716a 100644 --- a/web/src/auth/AuthCallback.js +++ b/web/src/auth/AuthCallback.js @@ -83,7 +83,6 @@ class AuthCallback extends React.Component { // Util.showMessage("success", `Authorization code: ${res.data}`); } } else { - // Util.showMessage("error", `Log in failed:${res.msg}`); this.setState({ msg: res.msg, }); diff --git a/web/src/auth/LoginPage.js b/web/src/auth/LoginPage.js index 46ed252d..81d34b75 100644 --- a/web/src/auth/LoginPage.js +++ b/web/src/auth/LoginPage.js @@ -168,12 +168,12 @@ class LoginPage extends React.Component { style={{width: "100%"}} disabled={!application.enablePassword} > - Login + Sign In { !application.enableSignUp ? null : (