summaryrefslogtreecommitdiffstats
path: root/api/oauth.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-07-29 14:58:37 -0400
committerChristopher Speller <crspeller@gmail.com>2016-07-29 14:58:37 -0400
commit3f8dda6f5ad676c976fd5ae575a6790fdb505449 (patch)
tree015a739989103ce38481176fd5d55f5f703789cb /api/oauth.go
parent748fdef1fbded624a786533e8f065b91a047b91c (diff)
downloadchat-3f8dda6f5ad676c976fd5ae575a6790fdb505449.tar.gz
chat-3f8dda6f5ad676c976fd5ae575a6790fdb505449.tar.bz2
chat-3f8dda6f5ad676c976fd5ae575a6790fdb505449.zip
PLT-3633 EE: Add Google and Office365 SSO through OAuth2 (#3660)
* EE: Add Google and Office365 SSO through OAuth2 * Add localization strings * Text tweaks for PLT-3633 * Added sign-up button for Office 365 * Updated some error messages and a bit of licensing * Updated sign-in method section in user settings to include Google and Office365 * Added more localization strings
Diffstat (limited to 'api/oauth.go')
-rw-r--r--api/oauth.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/api/oauth.go b/api/oauth.go
index f64fc638d..d41f526b4 100644
--- a/api/oauth.go
+++ b/api/oauth.go
@@ -26,9 +26,9 @@ func InitOAuth() {
BaseRoutes.OAuth.Handle("/register", ApiUserRequired(registerOAuthApp)).Methods("POST")
BaseRoutes.OAuth.Handle("/allow", ApiUserRequired(allowOAuth)).Methods("GET")
- BaseRoutes.OAuth.Handle("/{service:[A-Za-z]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
- BaseRoutes.OAuth.Handle("/{service:[A-Za-z]+}/login", AppHandlerIndependent(loginWithOAuth)).Methods("GET")
- BaseRoutes.OAuth.Handle("/{service:[A-Za-z]+}/signup", AppHandlerIndependent(signupWithOAuth)).Methods("GET")
+ BaseRoutes.OAuth.Handle("/{service:[A-Za-z0-9]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
+ BaseRoutes.OAuth.Handle("/{service:[A-Za-z0-9]+}/login", AppHandlerIndependent(loginWithOAuth)).Methods("GET")
+ BaseRoutes.OAuth.Handle("/{service:[A-Za-z0-9]+}/signup", AppHandlerIndependent(signupWithOAuth)).Methods("GET")
BaseRoutes.OAuth.Handle("/authorize", ApiUserRequired(authorizeOAuth)).Methods("GET")
BaseRoutes.OAuth.Handle("/access_token", ApiAppHandler(getAccessToken)).Methods("POST")
@@ -36,9 +36,9 @@ func InitOAuth() {
BaseRoutes.Root.Handle("/access_token", ApiAppHandler(getAccessToken)).Methods("POST")
// Handle all the old routes, to be later removed
- BaseRoutes.Root.Handle("/{service:[A-Za-z]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
- BaseRoutes.Root.Handle("/signup/{service:[A-Za-z]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
- BaseRoutes.Root.Handle("/login/{service:[A-Za-z]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
+ BaseRoutes.Root.Handle("/{service:[A-Za-z0-9]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
+ BaseRoutes.Root.Handle("/signup/{service:[A-Za-z0-9]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
+ BaseRoutes.Root.Handle("/login/{service:[A-Za-z0-9]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET")
}
func registerOAuthApp(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -624,7 +624,7 @@ func CompleteSwitchWithOAuth(c *Context, w http.ResponseWriter, r *http.Request,
provider := einterfaces.GetOauthProvider(service)
if provider == nil {
c.Err = model.NewLocAppError("CompleteClaimWithOAuth", "api.user.complete_switch_with_oauth.unavailable.app_error",
- map[string]interface{}{"Service": service}, "")
+ map[string]interface{}{"Service": strings.Title(service)}, "")
return
} else {
ssoUser := provider.GetUserFromJson(userData)