summaryrefslogtreecommitdiffstats
path: root/app/oauth.go
diff options
context:
space:
mode:
authorChris Duarte <csduarte@users.noreply.github.com>2017-11-28 11:46:48 -0800
committerChristopher Speller <crspeller@gmail.com>2017-11-28 11:46:48 -0800
commit27ba68a7894d5204b8d75dc7353774977d62fa15 (patch)
tree28af6c0900a1967ee8145575daca57c76f781d79 /app/oauth.go
parent785a410936daff5db7fba07dc5735bd74dd158bb (diff)
downloadchat-27ba68a7894d5204b8d75dc7353774977d62fa15.tar.gz
chat-27ba68a7894d5204b8d75dc7353774977d62fa15.tar.bz2
chat-27ba68a7894d5204b8d75dc7353774977d62fa15.zip
Add Config to disable Auth Transfers. (#7843)
* Add Config to disable Auth Transfers. * Set config ExperimentalEnableAuthenticationTransfer behind an E20 license restriction
Diffstat (limited to 'app/oauth.go')
-rw-r--r--app/oauth.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/oauth.go b/app/oauth.go
index f27facbec..3202ac5ed 100644
--- a/app/oauth.go
+++ b/app/oauth.go
@@ -717,6 +717,10 @@ func (a *App) AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service
}
func (a *App) SwitchEmailToOAuth(w http.ResponseWriter, r *http.Request, email, password, code, service string) (string, *model.AppError) {
+ if utils.IsLicensed() && !*a.Config().ServiceSettings.ExperimentalEnableAuthenticationTransfer {
+ return "", model.NewAppError("emailToOAuth", "api.user.email_to_oauth.not_available.app_error", nil, "", http.StatusForbidden)
+ }
+
var user *model.User
var err *model.AppError
if user, err = a.GetUserByEmail(email); err != nil {
@@ -743,6 +747,10 @@ func (a *App) SwitchEmailToOAuth(w http.ResponseWriter, r *http.Request, email,
}
func (a *App) SwitchOAuthToEmail(email, password, requesterId string) (string, *model.AppError) {
+ if utils.IsLicensed() && !*a.Config().ServiceSettings.ExperimentalEnableAuthenticationTransfer {
+ return "", model.NewAppError("oauthToEmail", "api.user.oauth_to_email.not_available.app_error", nil, "", http.StatusForbidden)
+ }
+
var user *model.User
var err *model.AppError
if user, err = a.GetUserByEmail(email); err != nil {