Replace "register" with "sign up".

This commit is contained in:
Yang Luo 2021-04-27 22:47:44 +08:00
parent 3793029491
commit 7a0ed4ebaf
13 changed files with 33 additions and 33 deletions

View File

@ -69,7 +69,7 @@ m = (r.subOwner == p.subOwner || p.subOwner == "*") && \
if true {
ruleText := `
p, built-in, *, *, *, *, *
p, *, *, POST, /api/register, *, *
p, *, *, POST, /api/signup, *, *
p, *, *, POST, /api/login, *, *
p, *, *, GET, /api/get-app-login, *, *
p, *, *, POST, /api/logout, *, *

View File

@ -54,13 +54,13 @@ type Response struct {
Data interface{} `json:"data"`
}
// @Title Register
// @Description register a new user
// @Param username formData string true "The username to register"
// @Title Signup
// @Description sign up a new user
// @Param username formData string true "The username to sign up"
// @Param password formData string true "The password"
// @Success 200 {object} controllers.Response The Response object
// @router /register [post]
func (c *ApiController) Register() {
// @router /signup [post]
func (c *ApiController) Signup() {
var resp Response
if c.GetSessionUser() != "" {
@ -76,7 +76,7 @@ func (c *ApiController) Register() {
panic(err)
}
msg := object.CheckUserRegister(form.Username, form.Password)
msg := object.CheckUserSignup(form.Username, form.Password)
if msg != "" {
resp = Response{Status: "error", Msg: msg, Data: ""}
} else {
@ -94,7 +94,7 @@ func (c *ApiController) Register() {
//c.SetSessionUser(user)
util.LogInfo(c.Ctx, "API: [%s] is registered as new user", user)
util.LogInfo(c.Ctx, "API: [%s] is signed up as new user", user)
resp = Response{Status: "ok", Msg: "", Data: user}
}
@ -143,7 +143,7 @@ func (c *ApiController) GetAccount() {
}
// @Title UploadAvatar
// @Description register a new user
// @Description upload avatar
// @Param avatarfile formData string true "The base64 encode of avatarfile"
// @Param password formData string true "The password"
// @Success 200 {object} controllers.Response The Response object

View File

@ -174,12 +174,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 sign up 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 create an account first", provider.Type, userInfo.Username)}
c.Data["json"] = resp
c.ServeJSON()
return

View File

@ -16,7 +16,7 @@ package object
import "fmt"
func CheckUserRegister(userId string, password string) string {
func CheckUserSignup(userId string, password string) string {
if len(userId) == 0 || len(password) == 0 {
return "username and password cannot be blank"
} else if HasUser(userId) {

View File

@ -39,7 +39,7 @@ func initAPI() {
)
beego.AddNamespace(ns)
beego.Router("/api/register", &controllers.ApiController{}, "POST:Register")
beego.Router("/api/signup", &controllers.ApiController{}, "POST:Signup")
beego.Router("/api/login", &controllers.ApiController{}, "POST:Login")
beego.Router("/api/get-app-login", &controllers.ApiController{}, "GET:GetApplicationLogin")
beego.Router("/api/logout", &controllers.ApiController{}, "POST:Logout")

View File

@ -33,7 +33,7 @@ import HomePage from "./basic/HomePage";
import CustomGithubCorner from "./CustomGithubCorner";
import * as Auth from "./auth/Auth";
import RegisterPage from "./auth/RegisterPage";
import SignupPage from "./auth/SignupPage";
import ResultPage from "./auth/ResultPage";
import LoginPage from "./auth/LoginPage";
import SelfLoginPage from "./auth/SelfLoginPage";
@ -94,7 +94,7 @@ class App extends Component {
this.setState({ selectedMenuKey: 4 });
} else if (uri.includes('tokens')) {
this.setState({ selectedMenuKey: 5 });
} else if (uri.includes('register')) {
} else if (uri.includes('signup')) {
this.setState({ selectedMenuKey: 100 });
} else if (uri.includes('login')) {
this.setState({ selectedMenuKey: 101 });
@ -214,8 +214,8 @@ class App extends Component {
} else if (this.state.account === null) {
res.push(
<Menu.Item key="100" style={{float: 'right', marginRight: '20px'}}>
<Link to="/register">
{i18next.t("account:Register")}
<Link to="/signup">
{i18next.t("account:Sign Up")}
</Link>
</Menu.Item>
);
@ -314,7 +314,7 @@ class App extends Component {
isStartPages() {
return window.location.pathname.startsWith('/login') ||
window.location.pathname.startsWith('/register') ||
window.location.pathname.startsWith('/signup') ||
window.location.pathname === '/';
}
@ -344,7 +344,7 @@ class App extends Component {
</Menu>
</Header>
<Switch>
<Route exact path="/register" render={(props) => this.renderHomeIfLoggedIn(<RegisterPage {...props} />)}/>
<Route exact path="/signup" render={(props) => this.renderHomeIfLoggedIn(<SignupPage {...props} />)}/>
<Route exact path="/result" render={(props) => this.renderHomeIfLoggedIn(<ResultPage {...props} />)}/>
<Route exact path="/login" render={(props) => this.renderHomeIfLoggedIn(<SelfLoginPage {...props} />)}/>
<Route exact path="/callback" component={AuthCallback}/>

View File

@ -22,8 +22,8 @@ export function getAccount(accessToken) {
}).then(res => res.json());
}
export function register(values) {
return fetch(`${authConfig.serverUrl}/api/register`, {
export function signup(values) {
return fetch(`${authConfig.serverUrl}/api/signup`, {
method: 'POST',
credentials: "include",
body: JSON.stringify(values),

View File

@ -210,7 +210,7 @@ class LoginPage extends React.Component {
!application.enableSignUp ? null : (
<div style={{float: "right"}}>
{i18next.t("login:No account yet?")}&nbsp;
<Link to={"/register"}>
<Link to={"/signup"}>
{i18next.t("login:sign up now")}
</Link>
</div>
@ -250,7 +250,7 @@ class LoginPage extends React.Component {
<br/>
<div style={{float: "right"}}>
No account yet?&nbsp;
<Link to={"/register"}>
<Link to={"/signup"}>
sign up now
</Link>
</div>

View File

@ -29,7 +29,7 @@ class ResultPage extends React.Component {
<div>
<Result
status="success"
title="Your account is registered"
title="Your account is created"
subTitle="Please click the below button to login"
extra={[
<Link to="/login">

View File

@ -52,7 +52,7 @@ const tailFormItemLayout = {
},
};
class RegisterPage extends React.Component {
class SignupPage extends React.Component {
constructor(props) {
super(props);
this.state = {
@ -63,12 +63,12 @@ class RegisterPage extends React.Component {
}
onFinish(values) {
AuthBackend.register(values)
AuthBackend.signup(values)
.then((res) => {
if (res.status === 'ok') {
this.props.history.push('/result');
} else {
Setting.showMessage("error", `Failed to register: ${res.msg}`);
Setting.showMessage("error", `Failed to sign up: ${res.msg}`);
}
});
}
@ -95,7 +95,7 @@ class RegisterPage extends React.Component {
<Form
{...formItemLayout}
ref={this.form}
name="register"
name="signup"
onFinish={(values) => this.onFinish(values)}
onFinishFailed={(errorInfo) => this.onFinishFailed(errorInfo.values, errorInfo.errorFields, errorInfo.outOfDate)}
initialValues={{
@ -249,4 +249,4 @@ class RegisterPage extends React.Component {
}
}
export default RegisterPage;
export default SignupPage;

View File

@ -58,8 +58,8 @@ export function renderMessageLarge(ths, msg) {
<Button key="home" onClick={() => Setting.goToLinkSoft(ths, "/")}>
Home
</Button>,
<Button type="primary" key="register" onClick={() => Setting.goToLinkSoft(ths, "/register")}>
Register
<Button type="primary" key="signup" onClick={() => Setting.goToLinkSoft(ths, "/signup")}>
Sign Up
</Button>,
]}
>

View File

@ -48,7 +48,7 @@
"Settings for your account": "Settings for your account",
"Login": "Login",
"Logout": "Logout",
"Register": "Register"
"Sign Up": "Sign Up"
},
"organization":
{

View File

@ -48,7 +48,7 @@
"Settings for your account": "账户设置选项",
"Login": "登录",
"Logout": "登出",
"Register": "注册"
"Sign Up": "注册"
},
"organization":
{