UX: Use 'tel' input type for 2FA token inputs.

This commit is contained in:
Guo Xiang Tan 2018-02-27 09:30:44 +08:00
parent 8296f493ed
commit 70f14da732
8 changed files with 17 additions and 30 deletions

View File

@ -21,10 +21,10 @@ export default Ember.Controller.extend({
},
toggleSecondFactor(enable) {
if (!this.get('second_factor_token')) return;
if (!this.get('secondFactorToken')) return;
this.set('loading', true);
this.get('content').toggleSecondFactor(this.get('second_factor_token'), enable)
this.get('content').toggleSecondFactor(this.get('secondFactorToken'), enable)
.then(response => {
if (response.error) {
this.set('errorMessage', response.error);

View File

@ -0,0 +1,8 @@
{{text-field value=value
type="tel"
pattern='[0-9]{6}'
maxlength='6'
id="login-second-factor"
autocorrect="off"
autocapitalize="off"
autofocus="autofocus"}}

View File

@ -45,13 +45,7 @@
</table>
</div>
{{#second-factor-form}}
{{text-field value=loginSecondFactor
pattern='[0-9]{6}'
maxlength='6'
id="login-second-factor"
autocorrect="off"
autocapitalize="off"
autofocus="autofocus"}}
{{second-factor-input value=loginSecondFactor}}
{{/second-factor-form}}
</form>
{{/if}}

View File

@ -34,13 +34,7 @@
</table>
</div>
{{#second-factor-form}}
{{text-field value=loginSecondFactor
pattern='[0-9]{6}'
maxlength='6'
id="login-second-factor"
autocorrect="off"
autocapitalize="off"
autofocus="autofocus"}}
{{second-factor-input value=loginSecondFactor}}
{{/second-factor-form}}
</form>
{{/if}}

View File

@ -19,12 +19,7 @@
<div class="control-group">
<div class="controls">
{{text-field value=second_factor_token
pattern='[0-9]{6}'
maxlength='6'
id="second-factor-token"
classNames="input-large"
autofocus="autofocus"}}
{{second-factor-input value=secondFactorToken}}
</div>
<div class='instructions'>
@ -70,12 +65,7 @@
<label class="control-label input-prepend">{{i18n 'login.second_factor_label'}}</label>
<div class="controls">
{{text-field value=second_factor_token
pattern='[0-9]{6}'
maxlength='6'
id="second-factor-token"
classNames="input-large"
autofocus="autofocus"}}
{{second-factor-input value=secondFactorToken}}
</div>
</div>

View File

@ -0,0 +1 @@
<%= text_field_tag(:second_factor_token, nil, autofocus: true, pattern: '[0-9]{6}', maxlength: 6, type: 'tel') %>

View File

@ -10,7 +10,7 @@
<%= form_tag(method: "post") do%>
<h2><%=t "login.second_factor_title" %></h2>
<%= label_tag(:second_factor_token, t("login.second_factor_description")) %>
<div><%= text_field_tag(:second_factor_token, pattern: '[0-9]{6}', maxlength: 6) %></div>
<div><%= render 'common/second_factor_text_field' %></div>
<%= submit_tag(t("submit"), class: "btn btn-large btn-primary") %>
<%end%>
</div>

View File

@ -10,7 +10,7 @@
<% if @second_factor_required %>
<%=form_tag({}, method: :put) do %>
<%= label_tag(:second_factor_token, t('login.second_factor_description')) %>
<%= text_field_tag(:second_factor_token, nil, autofocus: true, pattern: '[0-9]{6}', maxlength: 6) %><br><br>
<%= render 'common/second_factor_text_field' %><br><br>
<%= submit_tag t('submit')%>
<% end %>
<% end %>