From 72a107c9d73d1576f3adf7928deef4b5e5f35a83 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Wed, 4 Jun 2014 16:23:46 +0200 Subject: webui: add link pointing to OTP sync page to login https://fedorahosted.org/freeipa/ticket/4218 Reviewed-By: Endi Sukma Dewata --- install/ui/src/freeipa/plugins/login.js | 4 ++++ install/ui/src/freeipa/widgets/LoginScreen.js | 13 +++++++++++++ install/ui/test/data/ipa_init.json | 1 + ipalib/plugins/internal.py | 1 + 4 files changed, 19 insertions(+) diff --git a/install/ui/src/freeipa/plugins/login.js b/install/ui/src/freeipa/plugins/login.js index cf9e5bea8..c555ed2d9 100644 --- a/install/ui/src/freeipa/plugins/login.js +++ b/install/ui/src/freeipa/plugins/login.js @@ -75,6 +75,10 @@ define(['dojo/_base/declare', on(this, 'show', function(args) { login_screen.refresh(); }); + + on(login_screen, 'require-otp-sync', function(args) { + self.emit('require-otp-sync', args); + }); } }); diff --git a/install/ui/src/freeipa/widgets/LoginScreen.js b/install/ui/src/freeipa/widgets/LoginScreen.js index 6c448ff99..3e0986435 100644 --- a/install/ui/src/freeipa/widgets/LoginScreen.js +++ b/install/ui/src/freeipa/widgets/LoginScreen.js @@ -82,6 +82,13 @@ define(['dojo/_base/declare', render_buttons: function(container) { + this.sync_btn_node = IPA.button({ + label: text.get('@i18n:login.sync_otp_token', "Sync OTP Token"), + button_class: 'btn btn-link', + click: lang.hitch(this, this.on_sync) + })[0]; + construct.place(this.sync_btn_node, container); + this.login_btn_node = IPA.button({ label: text.get('@i18n:login.login', "Login"), 'class': 'btn-primary btn-lg', @@ -115,6 +122,11 @@ define(['dojo/_base/declare', p_f.set_required(required); }, + on_sync: function() { + var user = this.get_field('username').get_value()[0]; + this.emit('require-otp-sync', { source: this, user: user }); + }, + on_confirm: function() { if (this.view == 'login') { this.login(); @@ -231,6 +243,7 @@ define(['dojo/_base/declare', show_login_view: function() { this.set_login_aside_text(); if (this.buttons_node) { + construct.place(this.sync_btn_node, this.buttons_node); construct.place(this.login_btn_node, this.buttons_node); } if (this.password_enabled()) { diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index 3da2b4f4a..83ed670d0 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -148,6 +148,7 @@ "logout": "Logout", "logout_error": "Logout error", "password": "Password", + "sync_otp_token": "Sync OTP Token", "username": "Username" }, "measurement_units": { diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py index fab01164a..731142cd5 100644 --- a/ipalib/plugins/internal.py +++ b/ipalib/plugins/internal.py @@ -290,6 +290,7 @@ class i18n_messages(Command): "logout": _("Logout"), "logout_error": _("Logout error"), "password": _("Password"), + "sync_otp_token": _("Sync OTP Token"), "username": _("Username"), }, "measurement_units": { -- cgit