mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-22 18:25:47 +08:00
Rename to method.
This commit is contained in:
parent
faeb93494c
commit
20b70c323d
@ -45,7 +45,7 @@ func (c *ApiController) AuthLogin() {
|
||||
providerName := c.Input().Get("provider")
|
||||
code := c.Input().Get("code")
|
||||
state := c.Input().Get("state")
|
||||
addition := c.Input().Get("addition")
|
||||
method := c.Input().Get("method")
|
||||
RedirectURL := c.Input().Get("redirect_url")
|
||||
|
||||
provider := object.GetProvider(fmt.Sprintf("admin/%s", providerName))
|
||||
@ -131,7 +131,7 @@ func (c *ApiController) AuthLogin() {
|
||||
}()
|
||||
wg.Wait()
|
||||
|
||||
if addition == "signup" {
|
||||
if method == "signup" {
|
||||
userId := object.HasGithub(tempUserAccount.Login)
|
||||
if userId != "" {
|
||||
//if len(object.GetMemberAvatar(userId)) == 0 {
|
||||
@ -151,7 +151,7 @@ func (c *ApiController) AuthLogin() {
|
||||
res.IsSignedUp = false
|
||||
}
|
||||
}
|
||||
res.Addition = tempUserAccount.Login
|
||||
res.Method = tempUserAccount.Login
|
||||
res.Avatar = tempUserAccount.AvatarUrl
|
||||
resp = Response{Status: "ok", Msg: "success", Data: res}
|
||||
} else {
|
||||
|
@ -31,5 +31,5 @@ type authResponse struct {
|
||||
IsSignedUp bool `json:"isSignedUp"`
|
||||
Email string `json:"email"`
|
||||
Avatar string `json:"avatar"`
|
||||
Addition string `json:"addition"`
|
||||
Method string `json:"method"`
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ class App extends Component {
|
||||
</Header>
|
||||
<Switch>
|
||||
<Route exact path="/login" render={(props) => this.renderHomeIfLoggedIn(<LoginPage onLoggedIn={this.onLoggedIn.bind(this)} {...props} />)}/>
|
||||
<Route exact path="/callback/:providerType/:providerName/:addition" component={AuthCallback}/>
|
||||
<Route exact path="/callback/:providerType/:providerName/:method" component={AuthCallback}/>
|
||||
<Route exact path="/" render={(props) => this.renderLoginIfNotLoggedIn(<HomePage account={this.state.account} onLoggedIn={this.onLoggedIn.bind(this)} {...props} />)}/>
|
||||
<Route exact path="/account" render={(props) => this.renderLoginIfNotLoggedIn(<AccountPage account={this.state.account} {...props} />)}/>
|
||||
<Route exact path="/organizations" render={(props) => this.renderLoginIfNotLoggedIn(<OrganizationListPage account={this.state.account} {...props} />)}/>
|
||||
|
@ -44,8 +44,8 @@ export function logout() {
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function authLogin(providerName, code, state, redirectUrl, addition) {
|
||||
return fetch(`${Setting.ServerUrl}/api/auth/login?provider=${providerName}&code=${code}&state=${state}&redirect_url=${redirectUrl}&addition=${addition}`, {
|
||||
export function authLogin(providerName, code, state, redirectUrl, method) {
|
||||
return fetch(`${Setting.ServerUrl}/api/auth/login?provider=${providerName}&code=${code}&state=${state}&redirect_url=${redirectUrl}&method=${method}`, {
|
||||
method: 'GET',
|
||||
credentials: 'include',
|
||||
}).then(res => res.json());
|
||||
|
@ -26,7 +26,7 @@ class AuthCallback extends React.Component {
|
||||
classes: props,
|
||||
providerType: props.match.params.providerType,
|
||||
providerName: props.match.params.providerName,
|
||||
addition: props.match.params.addition,
|
||||
method: props.match.params.method,
|
||||
state: params.get("state"),
|
||||
code: params.get("code"),
|
||||
isAuthenticated: false,
|
||||
@ -49,8 +49,8 @@ class AuthCallback extends React.Component {
|
||||
|
||||
authLogin() {
|
||||
let redirectUrl;
|
||||
redirectUrl = `${getClientUrl()}/callback/${this.state.providerType}/${this.state.providerName}/${this.state.addition}`;
|
||||
AuthBackend.authLogin(this.state.providerName, this.state.code, this.state.state, redirectUrl, this.state.addition)
|
||||
redirectUrl = `${getClientUrl()}/callback/${this.state.providerType}/${this.state.providerName}/${this.state.method}`;
|
||||
AuthBackend.authLogin(this.state.providerName, this.state.code, this.state.state, redirectUrl, this.state.method)
|
||||
.then((res) => {
|
||||
if (res.status === "ok") {
|
||||
window.location.href = '/';
|
||||
|
Loading…
x
Reference in New Issue
Block a user