Remove Google as a SSO service.
Этот коммит содержится в:
@@ -34,15 +34,6 @@
|
||||
"AuthEndpoint": "",
|
||||
"TokenEndpoint": "",
|
||||
"UserApiEndpoint": ""
|
||||
},
|
||||
"google": {
|
||||
"Allow": false,
|
||||
"Secret": "",
|
||||
"Id": "",
|
||||
"Scope": "email profile",
|
||||
"AuthEndpoint": "https://accounts.google.com/o/oauth2/auth",
|
||||
"TokenEndpoint": "https://www.googleapis.com/oauth2/v3/token",
|
||||
"UserApiEndpoint": "https://www.googleapis.com/plus/v1/people/me"
|
||||
}
|
||||
},
|
||||
"SqlSettings": {
|
||||
|
||||
@@ -34,15 +34,6 @@
|
||||
"AuthEndpoint": "",
|
||||
"TokenEndpoint": "",
|
||||
"UserApiEndpoint": ""
|
||||
},
|
||||
"google": {
|
||||
"Allow": false,
|
||||
"Secret": "",
|
||||
"Id": "",
|
||||
"Scope": "email profile",
|
||||
"AuthEndpoint": "https://accounts.google.com/o/oauth2/auth",
|
||||
"TokenEndpoint": "https://www.googleapis.com/oauth2/v3/token",
|
||||
"UserApiEndpoint": "https://www.googleapis.com/plus/v1/people/me"
|
||||
}
|
||||
},
|
||||
"SqlSettings": {
|
||||
|
||||
@@ -34,15 +34,6 @@
|
||||
"AuthEndpoint": "",
|
||||
"TokenEndpoint": "",
|
||||
"UserApiEndpoint": ""
|
||||
},
|
||||
"google": {
|
||||
"Allow": false,
|
||||
"Secret": "",
|
||||
"Id": "",
|
||||
"Scope": "email profile",
|
||||
"AuthEndpoint": "https://accounts.google.com/o/oauth2/auth",
|
||||
"TokenEndpoint": "https://www.googleapis.com/oauth2/v3/token",
|
||||
"UserApiEndpoint": "https://www.googleapis.com/plus/v1/people/me"
|
||||
}
|
||||
},
|
||||
"SqlSettings": {
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
USER_AUTH_SERVICE_GOOGLE = "google"
|
||||
)
|
||||
|
||||
type GoogleUser struct {
|
||||
Id string `json:"id"`
|
||||
Nickname string `json:"nickname"`
|
||||
DisplayName string `json:"displayName"`
|
||||
Emails []map[string]string `json:"emails"`
|
||||
Names map[string]string `json:"name"`
|
||||
}
|
||||
|
||||
func UserFromGoogleUser(gu *GoogleUser) *User {
|
||||
user := &User{}
|
||||
user.FirstName = gu.Names["givenName"]
|
||||
user.LastName = gu.Names["familyName"]
|
||||
user.Nickname = gu.Nickname
|
||||
|
||||
for _, e := range gu.Emails {
|
||||
if e["type"] == "account" {
|
||||
user.Email = e["value"]
|
||||
user.Username = CleanUsername(strings.Split(user.Email, "@")[0])
|
||||
}
|
||||
}
|
||||
|
||||
user.AuthData = gu.Id
|
||||
user.AuthService = USER_AUTH_SERVICE_GOOGLE
|
||||
|
||||
return user
|
||||
}
|
||||
|
||||
func GoogleUserFromJson(data io.Reader) *GoogleUser {
|
||||
decoder := json.NewDecoder(data)
|
||||
var gu GoogleUser
|
||||
err := decoder.Decode(&gu)
|
||||
if err == nil {
|
||||
return &gu
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (gu *GoogleUser) GetAuthData() string {
|
||||
return gu.Id
|
||||
}
|
||||
@@ -110,18 +110,6 @@ export default class Login extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
if (authServices.indexOf(Constants.GOOGLE_SERVICE) !== -1) {
|
||||
loginMessage.push(
|
||||
<a
|
||||
className='btn btn-custom-login google'
|
||||
href={'/' + teamName + '/login/google'}
|
||||
>
|
||||
<span className='icon' />
|
||||
<span>with Google Apps</span>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
var errorClass = '';
|
||||
if (serverError) {
|
||||
errorClass = ' has-error';
|
||||
|
||||
@@ -162,15 +162,6 @@ module.exports = React.createClass({
|
||||
);
|
||||
}
|
||||
|
||||
if (authServices.indexOf(Constants.GOOGLE_SERVICE) >= 0) {
|
||||
signupMessage.push(
|
||||
<a className='btn btn-custom-login google' href={'/' + this.props.teamName + '/signup/google' + window.location.search}>
|
||||
<span className='icon' />
|
||||
<span>with Google</span>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
var emailSignup;
|
||||
if (authServices.indexOf(Constants.EMAIL_SERVICE) !== -1) {
|
||||
emailSignup = (
|
||||
|
||||
@@ -28,24 +28,6 @@ export default class ChooseAuthPage extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
if (this.props.services.indexOf(Constants.GOOGLE_SERVICE) !== -1) {
|
||||
buttons.push(
|
||||
<a
|
||||
className='btn btn-custom-login google btn-full'
|
||||
href='#'
|
||||
onClick={
|
||||
function clickGoogle(e) {
|
||||
e.preventDefault();
|
||||
this.props.updatePage('service', Constants.GOOGLE_SERVICE);
|
||||
}.bind(this)
|
||||
}
|
||||
>
|
||||
<span className='icon' />
|
||||
<span>Create new {strings.Team} with Google Apps Account</span>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
if (this.props.services.indexOf(Constants.EMAIL_SERVICE) !== -1) {
|
||||
buttons.push(
|
||||
<a
|
||||
|
||||
@@ -86,18 +86,6 @@ export default class SSOSignUpPage extends React.Component {
|
||||
<span>Create {strings.Team} with GitLab Account</span>
|
||||
</a>
|
||||
);
|
||||
} else if (this.props.service === Constants.GOOGLE_SERVICE) {
|
||||
button = (
|
||||
<a
|
||||
className='btn btn-custom-login google btn-full'
|
||||
href='#'
|
||||
onClick={this.handleSubmit}
|
||||
disabled={disabled}
|
||||
>
|
||||
<span className='icon'/>
|
||||
<span>Create {strings.Team} with Google Apps Account</span>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -60,7 +60,6 @@ module.exports = {
|
||||
DEFAULT_CHANNEL: 'town-square',
|
||||
OFFTOPIC_CHANNEL: 'off-topic',
|
||||
GITLAB_SERVICE: 'gitlab',
|
||||
GOOGLE_SERVICE: 'google',
|
||||
EMAIL_SERVICE: 'email',
|
||||
POST_CHUNK_SIZE: 60,
|
||||
MAX_POST_CHUNKS: 3,
|
||||
|
||||
@@ -521,9 +521,6 @@ func signupCompleteOAuth(c *api.Context, w http.ResponseWriter, r *http.Request)
|
||||
if service == model.USER_AUTH_SERVICE_GITLAB {
|
||||
glu := model.GitLabUserFromJson(body)
|
||||
user = model.UserFromGitLabUser(glu)
|
||||
} else if service == model.USER_AUTH_SERVICE_GOOGLE {
|
||||
gu := model.GoogleUserFromJson(body)
|
||||
user = model.UserFromGoogleUser(gu)
|
||||
}
|
||||
|
||||
if user == nil {
|
||||
@@ -620,9 +617,6 @@ func loginCompleteOAuth(c *api.Context, w http.ResponseWriter, r *http.Request)
|
||||
if service == model.USER_AUTH_SERVICE_GITLAB {
|
||||
glu := model.GitLabUserFromJson(body)
|
||||
authData = glu.GetAuthData()
|
||||
} else if service == model.USER_AUTH_SERVICE_GOOGLE {
|
||||
gu := model.GoogleUserFromJson(body)
|
||||
authData = gu.GetAuthData()
|
||||
}
|
||||
|
||||
if len(authData) == 0 {
|
||||
|
||||
Ссылка в новой задаче
Block a user