discourse/app/views/users/password_reset.html.erb

70 lines
2.4 KiB
Plaintext
Raw Normal View History

2013-02-05 14:16:51 -05:00
<div id="simple-container">
<%if @error%>
2013-02-05 14:16:51 -05:00
<div class='alert alert-error'>
<%= @error %>
2013-02-05 14:16:51 -05:00
</div>
<%end%>
<% if @user.present? and @user.errors.any? %>
<div class='alert alert-error'>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</div>
<% end %>
<%if @success%>
2013-02-05 14:16:51 -05:00
<p>
<%= @success %>
<%- if @requires_approval %>
<%= t 'login.not_approved' %>
<% else %>
<br>
<br>
<a class="btn" href="<%= path "/" %>"><%= t('password_reset.continue', site_name: SiteSetting.title) %></a>
<% end %>
2013-02-05 14:16:51 -05:00
</p>
<% else %>
<%if @user.present? %>
<h3>
<% if @user.has_password? %>
<%= t 'password_reset.choose_new' %>
<% else %>
<%= t 'password_reset.choose' %>
<% end %>
</h3>
2013-02-05 14:16:51 -05:00
<%=form_tag({}, method: :put) do %>
<p>
<span style="display: none;"><input name="username" type="text" value="<%= @user.username %>"></span>
<input id="user_password" name="password" size="30" type="password" maxlength="<%= User.max_password_length %>" onkeypress="capsLock(event)">
<label><%= t('js.user.password.instructions', count: @user.admin? ? SiteSetting.min_admin_password_length : SiteSetting.min_password_length) %></label>
2013-02-05 14:16:51 -05:00
</p>
<div id="capsLockWarning" class="caps-lock-warning" style="visibility:hidden"><i class="fa fa-exclamation-triangle"></i> <%= t 'js.login.caps_lock_warning' %></div>
2013-02-05 14:16:51 -05:00
<p>
<%=submit_tag( @user.has_password? ? t('password_reset.update') : t('password_reset.save'), class: 'btn')%>
2013-02-05 14:16:51 -05:00
</p>
<%end%>
<%end%>
<%end%>
</div>
<%- content_for(:no_ember_head) do %>
<meta name="referrer" content="never">
<%= script "ember_jquery" %>
<%= render_google_universal_analytics_code %>
<%- end %>
2013-02-05 14:16:51 -05:00
<script type="text/javascript">
document.getElementById('user_password').focus();
function capsLock(e) {
kc = e.keyCode?e.keyCode:e.which;
sk = e.shiftKey?e.shiftKey:((kc == 16)?true:false);
(((kc >= 65 && kc <= 90) && !sk)||((kc >= 97 && kc <= 122) && sk)) ? document.getElementById('capsLockWarning').style.visibility = 'visible' : document.getElementById('capsLockWarning').style.visibility = 'hidden';
}
$.ajax('<%= path "/users/confirm-email-token/#{params[:token]}" %>', {dataType: 'json'});
2013-02-05 14:16:51 -05:00
</script>
<%= render_google_analytics_code %>