From b3816a2727648b579b92d007079189b1e2971b8f Mon Sep 17 00:00:00 2001 From: Peter Holmberg Date: Fri, 29 Nov 2019 16:38:03 +0100 Subject: [PATCH] Navigation: Fix navigation when new password is chosen (#20747) --- .../components/Login/LoginServiceButtons.tsx | 68 ++++++++++--------- public/app/partials/reset_password.html | 2 +- 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/public/app/core/components/Login/LoginServiceButtons.tsx b/public/app/core/components/Login/LoginServiceButtons.tsx index d85612bb655..65efccc4109 100644 --- a/public/app/core/components/Login/LoginServiceButtons.tsx +++ b/public/app/core/components/Login/LoginServiceButtons.tsx @@ -1,38 +1,42 @@ import React from 'react'; import config from 'app/core/config'; -const loginServices: () => LoginServices = () => ({ - saml: { - enabled: config.samlEnabled, - name: 'SAML', - className: 'github', - icon: 'key', - }, - google: { - enabled: config.oauth.google, - name: 'Google', - }, - github: { - enabled: config.oauth.github, - name: 'GitHub', - }, - gitlab: { - enabled: config.oauth.gitlab, - name: 'GitLab', - }, - grafanacom: { - enabled: config.oauth.grafana_com, - name: 'Grafana.com', - hrefName: 'grafana_com', - icon: 'grafana_com', - }, - oauth: { - enabled: config.oauth.generic_oauth, - name: config.oauth.generic_oauth ? config.oauth.generic_oauth.name : 'OAuth', - icon: 'sign-in', - hrefName: 'generic_oauth', - }, -}); +const loginServices: () => LoginServices = () => { + const oauthEnabled = !!config.oauth; + + return { + saml: { + enabled: config.samlEnabled, + name: 'SAML', + className: 'github', + icon: 'key', + }, + google: { + enabled: oauthEnabled && config.oauth.google, + name: 'Google', + }, + github: { + enabled: oauthEnabled && config.oauth.github, + name: 'GitHub', + }, + gitlab: { + enabled: oauthEnabled && config.oauth.gitlab, + name: 'GitLab', + }, + grafanacom: { + enabled: oauthEnabled && config.oauth.grafana_com, + name: 'Grafana.com', + hrefName: 'grafana_com', + icon: 'grafana_com', + }, + oauth: { + enabled: oauthEnabled && config.oauth.generic_oauth, + name: oauthEnabled && config.oauth.generic_oauth ? config.oauth.generic_oauth.name : 'OAuth', + icon: 'sign-in', + hrefName: 'generic_oauth', + }, + }; +}; export interface LoginService { enabled: boolean; diff --git a/public/app/partials/reset_password.html b/public/app/partials/reset_password.html index 085cc34d111..60f881e0cea 100644 --- a/public/app/partials/reset_password.html +++ b/public/app/partials/reset_password.html @@ -10,7 +10,7 @@
You cannot reset password when login form is disabled.
-
+
User