diff --git a/controllers/auth.go b/controllers/auth.go
index c273a29b..45150963 100644
--- a/controllers/auth.go
+++ b/controllers/auth.go
@@ -342,7 +342,28 @@ func (c *ApiController) Login() {
return
}
+ var application *object.Application
+ application, err = object.GetApplication(fmt.Sprintf("admin/%s", authForm.Application))
+ if err != nil {
+ c.ResponseError(err.Error(), nil)
+ return
+ }
+
+ if application == nil {
+ c.ResponseError(fmt.Sprintf(c.T("auth:The application: %s does not exist"), authForm.Application))
+ return
+ }
+
verificationCodeType := object.GetVerifyType(authForm.Username)
+ if verificationCodeType == object.VerifyTypeEmail && !application.IsCodeSigninViaEmailEnabled() {
+ c.ResponseError(c.T("auth:The login method: login with email is not enabled for the application"))
+ return
+ }
+ if verificationCodeType == object.VerifyTypePhone && !application.IsCodeSigninViaSmsEnabled() {
+ c.ResponseError(c.T("auth:The login method: login with SMS is not enabled for the application"))
+ return
+ }
+
var checkDest string
if verificationCodeType == object.VerifyTypePhone {
authForm.CountryCode = user.GetCountryCode(authForm.CountryCode)
@@ -378,7 +399,7 @@ func (c *ApiController) Login() {
c.ResponseError(fmt.Sprintf(c.T("auth:The application: %s does not exist"), authForm.Application))
return
}
- if !application.EnablePassword {
+ if !application.IsPasswordEnabled() {
c.ResponseError(c.T("auth:The login method: login with password is not enabled for the application"))
return
}
diff --git a/i18n/locales/ar/data.json b/i18n/locales/ar/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/ar/data.json
+++ b/i18n/locales/ar/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/de/data.json b/i18n/locales/de/data.json
index 8839adc3..a07d102d 100644
--- a/i18n/locales/de/data.json
+++ b/i18n/locales/de/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "Das Konto für den Anbieter %s und Benutzernamen %s (%s) existiert nicht und es ist nicht erlaubt, ein neues Konto anzumelden. Bitte wenden Sie sich an Ihren IT-Support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "Das Konto für den Anbieter %s und Benutzernamen %s (%s) ist bereits mit einem anderen Konto verknüpft: %s (%s)",
"The application: %s does not exist": "Die Anwendung: %s existiert nicht",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "Die Anmeldeart \"Anmeldung mit Passwort\" ist für die Anwendung nicht aktiviert",
"The provider: %s is not enabled for the application": "Der Anbieter: %s ist nicht für die Anwendung aktiviert",
"Unauthorized operation": "Nicht autorisierte Operation",
diff --git a/i18n/locales/en/data.json b/i18n/locales/en/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/en/data.json
+++ b/i18n/locales/en/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/es/data.json b/i18n/locales/es/data.json
index 17b8f517..5510005d 100644
--- a/i18n/locales/es/data.json
+++ b/i18n/locales/es/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "La cuenta para el proveedor: %s y el nombre de usuario: %s (%s) no existe y no se permite registrarse como una nueva cuenta, por favor contacte a su soporte de TI",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "La cuenta para proveedor: %s y nombre de usuario: %s (%s) ya está vinculada a otra cuenta: %s (%s)",
"The application: %s does not exist": "La aplicación: %s no existe",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "El método de inicio de sesión: inicio de sesión con contraseña no está habilitado para la aplicación",
"The provider: %s is not enabled for the application": "El proveedor: %s no está habilitado para la aplicación",
"Unauthorized operation": "Operación no autorizada",
diff --git a/i18n/locales/fa/data.json b/i18n/locales/fa/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/fa/data.json
+++ b/i18n/locales/fa/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/fi/data.json b/i18n/locales/fi/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/fi/data.json
+++ b/i18n/locales/fi/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/fr/data.json b/i18n/locales/fr/data.json
index 7403610e..36a83edc 100644
--- a/i18n/locales/fr/data.json
+++ b/i18n/locales/fr/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "Le compte pour le fournisseur : %s et le nom d'utilisateur : %s (%s) n'existe pas et n'est pas autorisé à s'inscrire comme nouveau compte, veuillez contacter votre support informatique",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "Le compte du fournisseur : %s et le nom d'utilisateur : %s (%s) sont déjà liés à un autre compte : %s (%s)",
"The application: %s does not exist": "L'application : %s n'existe pas",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "La méthode de connexion : connexion avec mot de passe n'est pas activée pour l'application",
"The provider: %s is not enabled for the application": "Le fournisseur :%s n'est pas activé pour l'application",
"Unauthorized operation": "Opération non autorisée",
diff --git a/i18n/locales/he/data.json b/i18n/locales/he/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/he/data.json
+++ b/i18n/locales/he/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/id/data.json b/i18n/locales/id/data.json
index 4ddd9d6b..32c91a1d 100644
--- a/i18n/locales/id/data.json
+++ b/i18n/locales/id/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "Akun untuk penyedia: %s dan nama pengguna: %s (%s) tidak ada dan tidak diizinkan untuk mendaftar sebagai akun baru, silakan hubungi dukungan IT Anda",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "Akun untuk provider: %s dan username: %s (%s) sudah terhubung dengan akun lain: %s (%s)",
"The application: %s does not exist": "Aplikasi: %s tidak ada",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "Metode login: login dengan kata sandi tidak diaktifkan untuk aplikasi tersebut",
"The provider: %s is not enabled for the application": "Penyedia: %s tidak diaktifkan untuk aplikasi ini",
"Unauthorized operation": "Operasi tidak sah",
diff --git a/i18n/locales/it/data.json b/i18n/locales/it/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/it/data.json
+++ b/i18n/locales/it/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/ja/data.json b/i18n/locales/ja/data.json
index 0f57f492..fab0884f 100644
--- a/i18n/locales/ja/data.json
+++ b/i18n/locales/ja/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "プロバイダー名:%sとユーザー名:%s(%s)のアカウントは存在しません。新しいアカウントとしてサインアップすることはできません。 ITサポートに連絡してください",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "プロバイダのアカウント:%s とユーザー名:%s (%s) は既に別のアカウント:%s (%s) にリンクされています",
"The application: %s does not exist": "アプリケーション: %sは存在しません",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "ログイン方法:パスワードでのログインはアプリケーションで有効になっていません",
"The provider: %s is not enabled for the application": "プロバイダー:%sはアプリケーションでは有効化されていません",
"Unauthorized operation": "不正操作",
diff --git a/i18n/locales/kk/data.json b/i18n/locales/kk/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/kk/data.json
+++ b/i18n/locales/kk/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/ko/data.json b/i18n/locales/ko/data.json
index 0bbc4fe3..22597506 100644
--- a/i18n/locales/ko/data.json
+++ b/i18n/locales/ko/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "공급자 계정 %s과 사용자 이름 %s (%s)는 존재하지 않으며 새 계정으로 등록할 수 없습니다. IT 지원팀에 문의하십시오",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "공급자 계정 %s과 사용자 이름 %s(%s)는 이미 다른 계정 %s(%s)에 연결되어 있습니다",
"The application: %s does not exist": "해당 애플리케이션(%s)이 존재하지 않습니다",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "어플리케이션에서는 암호를 사용한 로그인 방법이 활성화되어 있지 않습니다",
"The provider: %s is not enabled for the application": "제공자 %s은(는) 응용 프로그램에서 활성화되어 있지 않습니다",
"Unauthorized operation": "무단 조작",
diff --git a/i18n/locales/ms/data.json b/i18n/locales/ms/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/ms/data.json
+++ b/i18n/locales/ms/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/nl/data.json b/i18n/locales/nl/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/nl/data.json
+++ b/i18n/locales/nl/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/pl/data.json b/i18n/locales/pl/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/pl/data.json
+++ b/i18n/locales/pl/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/pt/data.json b/i18n/locales/pt/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/pt/data.json
+++ b/i18n/locales/pt/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/ru/data.json b/i18n/locales/ru/data.json
index e951386a..0ea39d34 100644
--- a/i18n/locales/ru/data.json
+++ b/i18n/locales/ru/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "Аккаунт для провайдера: %s и имя пользователя: %s (%s) не существует и не может быть зарегистрирован как новый аккаунт. Пожалуйста, обратитесь в службу поддержки IT",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "Аккаунт поставщика: %s и имя пользователя: %s (%s) уже связаны с другим аккаунтом: %s (%s)",
"The application: %s does not exist": "Приложение: %s не существует",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "Метод входа: вход с паролем не включен для приложения",
"The provider: %s is not enabled for the application": "Провайдер: %s не включен для приложения",
"Unauthorized operation": "Несанкционированная операция",
diff --git a/i18n/locales/sv/data.json b/i18n/locales/sv/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/sv/data.json
+++ b/i18n/locales/sv/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/tr/data.json b/i18n/locales/tr/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/tr/data.json
+++ b/i18n/locales/tr/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/uk/data.json b/i18n/locales/uk/data.json
index 28b3df94..2987a3f8 100644
--- a/i18n/locales/uk/data.json
+++ b/i18n/locales/uk/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)",
"The application: %s does not exist": "The application: %s does not exist",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
"Unauthorized operation": "Unauthorized operation",
diff --git a/i18n/locales/vi/data.json b/i18n/locales/vi/data.json
index 13f8130a..9f276de0 100644
--- a/i18n/locales/vi/data.json
+++ b/i18n/locales/vi/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "Tài khoản cho nhà cung cấp: %s và tên người dùng: %s (%s) không tồn tại và không được phép đăng ký như một tài khoản mới, vui lòng liên hệ với bộ phận hỗ trợ công nghệ thông tin của bạn",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "Tài khoản cho nhà cung cấp: %s và tên người dùng: %s (%s) đã được liên kết với tài khoản khác: %s (%s)",
"The application: %s does not exist": "Ứng dụng: %s không tồn tại",
+ "The login method: login with SMS is not enabled for the application": "The login method: login with SMS is not enabled for the application",
+ "The login method: login with email is not enabled for the application": "The login method: login with email is not enabled for the application",
"The login method: login with password is not enabled for the application": "Phương thức đăng nhập: đăng nhập bằng mật khẩu không được kích hoạt cho ứng dụng",
"The provider: %s is not enabled for the application": "Nhà cung cấp: %s không được kích hoạt cho ứng dụng",
"Unauthorized operation": "Hoạt động không được ủy quyền",
diff --git a/i18n/locales/zh/data.json b/i18n/locales/zh/data.json
index d2df556c..a52e42b9 100644
--- a/i18n/locales/zh/data.json
+++ b/i18n/locales/zh/data.json
@@ -15,6 +15,8 @@
"The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "提供商账户: %s 与用户名: %s (%s) 不存在且 不允许注册新账户, 请联系IT支持",
"The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "提供商账户: %s与用户名: %s (%s)已经与其他账户绑定: %s (%s)",
"The application: %s does not exist": "应用%s不存在",
+ "The login method: login with SMS is not enabled for the application": "该应用禁止采用短信登录方式",
+ "The login method: login with email is not enabled for the application": "该应用禁止采用邮箱登录方式",
"The login method: login with password is not enabled for the application": "该应用禁止采用密码登录方式",
"The provider: %s is not enabled for the application": "该应用的提供商: %s未被启用",
"Unauthorized operation": "未授权的操作",
diff --git a/init_data.json.template b/init_data.json.template
index d6ef4e84..872a5abe 100644
--- a/init_data.json.template
+++ b/init_data.json.template
@@ -45,6 +45,23 @@
"alertType": "None"
}
],
+ "signinMethods": [
+ {
+ "name": "Password",
+ "displayName": "Password",
+ "rule": "None",
+ },
+ {
+ "name": "Verification code",
+ "displayName": "Verification code",
+ "rule": "All",
+ },
+ {
+ "name": "WebAuthn",
+ "displayName": "WebAuthn",
+ "rule": "None",
+ },
+ ],
"signupItems": [
{
"name": "ID",
diff --git a/object/application.go b/object/application.go
index 10a7934c..8f21615e 100644
--- a/object/application.go
+++ b/object/application.go
@@ -24,6 +24,12 @@ import (
"github.com/xorm-io/core"
)
+type SigninMethod struct {
+ Name string `xorm:"varchar(100) notnull pk" json:"name"`
+ DisplayName string `xorm:"varchar(100)" json:"displayName"`
+ Rule string `json:"rule"`
+}
+
type SignupItem struct {
Name string `json:"name"`
Visible bool `json:"visible"`
@@ -63,6 +69,7 @@ type Application struct {
OrgChoiceMode string `json:"orgChoiceMode"`
SamlReplyUrl string `xorm:"varchar(100)" json:"samlReplyUrl"`
Providers []*ProviderItem `xorm:"mediumtext" json:"providers"`
+ SigninMethods []*SigninMethod `xorm:"varchar(2000)" json:"signinMethods"`
SignupItems []*SignupItem `xorm:"varchar(2000)" json:"signupItems"`
GrantTypes []string `xorm:"varchar(1000)" json:"grantTypes"`
OrganizationObj *Organization `xorm:"-" json:"organizationObj"`
@@ -191,6 +198,25 @@ func extendApplicationWithOrg(application *Application) (err error) {
return
}
+func extendApplicationWithSigninMethods(application *Application) (err error) {
+ if len(application.SigninMethods) == 0 {
+ if application.EnablePassword {
+ signinMethod := &SigninMethod{Name: "Password", DisplayName: "Password", Rule: "None"}
+ application.SigninMethods = append(application.SigninMethods, signinMethod)
+ }
+ if application.EnableCodeSignin {
+ signinMethod := &SigninMethod{Name: "Verification code", DisplayName: "Verification code", Rule: "All"}
+ application.SigninMethods = append(application.SigninMethods, signinMethod)
+ }
+ if application.EnableWebAuthn {
+ signinMethod := &SigninMethod{Name: "WebAuthn", DisplayName: "WebAuthn", Rule: "None"}
+ application.SigninMethods = append(application.SigninMethods, signinMethod)
+ }
+ }
+
+ return
+}
+
func getApplication(owner string, name string) (*Application, error) {
if owner == "" || name == "" {
return nil, nil
@@ -213,6 +239,11 @@ func getApplication(owner string, name string) (*Application, error) {
return nil, err
}
+ err = extendApplicationWithSigninMethods(&application)
+ if err != nil {
+ return nil, err
+ }
+
return &application, nil
} else {
return nil, nil
@@ -237,6 +268,11 @@ func GetApplicationByOrganizationName(organization string) (*Application, error)
return nil, err
}
+ err = extendApplicationWithSigninMethods(&application)
+ if err != nil {
+ return nil, err
+ }
+
return &application, nil
} else {
return nil, nil
@@ -284,6 +320,11 @@ func GetApplicationByClientId(clientId string) (*Application, error) {
return nil, err
}
+ err = extendApplicationWithSigninMethods(&application)
+ if err != nil {
+ return nil, err
+ }
+
return &application, nil
} else {
return nil, nil
@@ -485,6 +526,45 @@ func (application *Application) IsRedirectUriValid(redirectUri string) bool {
return false
}
+func (application *Application) IsPasswordEnabled() bool {
+ if len(application.SigninMethods) == 0 {
+ return application.EnablePassword
+ } else {
+ for _, signinMethod := range application.SigninMethods {
+ if signinMethod.Name == "Password" {
+ return true
+ }
+ }
+ return false
+ }
+}
+
+func (application *Application) IsCodeSigninViaEmailEnabled() bool {
+ if len(application.SigninMethods) == 0 {
+ return application.EnableCodeSignin
+ } else {
+ for _, signinMethod := range application.SigninMethods {
+ if signinMethod.Name == "Verification code" && signinMethod.Rule != "Phone only" {
+ return true
+ }
+ }
+ return false
+ }
+}
+
+func (application *Application) IsCodeSigninViaSmsEnabled() bool {
+ if len(application.SigninMethods) == 0 {
+ return application.EnableCodeSignin
+ } else {
+ for _, signinMethod := range application.SigninMethods {
+ if signinMethod.Name == "Verification code" && signinMethod.Rule != "Email only" {
+ return true
+ }
+ }
+ return false
+ }
+}
+
func IsOriginAllowed(origin string) (bool, error) {
applications, err := GetApplications("")
if err != nil {
diff --git a/object/init.go b/object/init.go
index 3584cb66..edd9da25 100644
--- a/object/init.go
+++ b/object/init.go
@@ -180,6 +180,11 @@ func initBuiltInApplication() {
Providers: []*ProviderItem{
{Name: "provider_captcha_default", CanSignUp: false, CanSignIn: false, CanUnlink: false, Prompted: false, SignupGroup: "", Rule: "None", Provider: nil},
},
+ SigninMethods: []*SigninMethod{
+ {Name: "Password", DisplayName: "Password", Rule: "None"},
+ {Name: "Verification code", DisplayName: "Verification code", Rule: "All"},
+ {Name: "WebAuthn", DisplayName: "WebAuthn", Rule: "None"},
+ },
SignupItems: []*SignupItem{
{Name: "ID", Visible: false, Required: true, Prompted: false, Rule: "Random"},
{Name: "Username", Visible: true, Required: true, Prompted: false, Rule: "None"},
diff --git a/object/init_data.go b/object/init_data.go
index 083614d6..b0ac54f3 100644
--- a/object/init_data.go
+++ b/object/init_data.go
@@ -136,6 +136,9 @@ func readInitDataFromFile(filePath string) (*InitData, error) {
if application.Providers == nil {
application.Providers = []*ProviderItem{}
}
+ if application.SigninMethods == nil {
+ application.SigninMethods = []*SigninMethod{}
+ }
if application.SignupItems == nil {
application.SignupItems = []*SignupItem{}
}
diff --git a/web/src/ApplicationEditPage.js b/web/src/ApplicationEditPage.js
index f1261d57..156934d1 100644
--- a/web/src/ApplicationEditPage.js
+++ b/web/src/ApplicationEditPage.js
@@ -27,6 +27,7 @@ import LoginPage from "./auth/LoginPage";
import i18next from "i18next";
import UrlTable from "./table/UrlTable";
import ProviderTable from "./table/ProviderTable";
+import SigninTable from "./table/SigninTable";
import SignupTable from "./table/SignupTable";
import SamlAttributeTable from "./table/SamlAttributeTable";
import PromptPage from "./auth/PromptPage";
@@ -429,16 +430,6 @@ class ApplicationEditPage extends React.Component {
}} />
-
-