Commit 33292095 by gotjosh Committed by GitHub

SAML: Show SAML login button even if OAuth is disabled (#17993)

* Move the SAML button outside of the oauth div
* Don't attempt to search cookies with an empty name
parent 78ca55f3
...@@ -182,6 +182,10 @@ func initContextWithBasicAuth(ctx *models.ReqContext, orgId int64) bool { ...@@ -182,6 +182,10 @@ func initContextWithBasicAuth(ctx *models.ReqContext, orgId int64) bool {
} }
func initContextWithToken(authTokenService models.UserTokenService, ctx *models.ReqContext, orgID int64) bool { func initContextWithToken(authTokenService models.UserTokenService, ctx *models.ReqContext, orgID int64) bool {
if setting.LoginCookieName == "" {
return false
}
rawToken := ctx.GetCookie(setting.LoginCookieName) rawToken := ctx.GetCookie(setting.LoginCookieName)
if rawToken == "" { if rawToken == "" {
return false return false
......
...@@ -45,6 +45,10 @@ ...@@ -45,6 +45,10 @@
</div> </div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<a class="btn btn-medium btn-service btn-service--github login-btn" href="login/saml" target="_self" ng-if="samlEnabled">
<i class="btn-service-icon fa fa-key"></i>
Sign in with SAML
</a>
<div class="login-oauth text-center" ng-show="oauthEnabled"> <div class="login-oauth text-center" ng-show="oauthEnabled">
<a class="btn btn-medium btn-service btn-service--google login-btn" href="login/google" target="_self" ng-if="oauth.google"> <a class="btn btn-medium btn-service btn-service--google login-btn" href="login/google" target="_self" ng-if="oauth.google">
<i class="btn-service-icon fa fa-google"></i> <i class="btn-service-icon fa fa-google"></i>
...@@ -68,10 +72,6 @@ ...@@ -68,10 +72,6 @@
<i class="btn-service-icon fa fa-sign-in"></i> <i class="btn-service-icon fa fa-sign-in"></i>
Sign in with {{oauth.generic_oauth.name}} Sign in with {{oauth.generic_oauth.name}}
</a> </a>
<a class="btn btn-medium btn-service btn-service--github login-btn" href="login/saml" target="_self" ng-if="samlEnabled">
<i class="btn-service-icon fa fa-key"></i>
Sign in with SAML
</a>
</div> </div>
<div class="login-signup-box" ng-show="!disableUserSignUp"> <div class="login-signup-box" ng-show="!disableUserSignUp">
<div class="login-signup-title p-r-1"> <div class="login-signup-title p-r-1">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment