olympiamanagement/app/views/olympiamanagements/_edit_password.html.erb

58 lines
3.0 KiB
Plaintext

<h3 align="center"><span><%=t('olympiamanagement.edit_password')%></span></h3>
<form name="login_form" id="login_form" method="get">
<p align="center">
<label for="new_password"><%=t('olympiamanagement.new_password')%>:</label><input name="new_password" type="password" id="new_password" size="25">
<br>
<label for="confirm_password"><%=t('olympiamanagement.confirm_password')%>:</label><input name="confirm_password" type="password" id="confirm_password" size="25">
</p>
<p align="center">
<input id="submit_button" type="submit" name="Submit" value="<%=t('olympiamanagement.submit')%>">
<input id="submit_button" type="button" name="goback" value="<%=t('olympiamanagement.back_to_previous_page')%>" onkeypress="window.history.go(-1);" onclick="window.history.go(-1);">
<input type="hidden" name="PreviousPage" value="<%= OrbitHelper.request.original_url.split(OrbitHelper.request.env["HTTP_HOST"]).last.split('?').first rescue "/"%>">
</p>
</form>
<%if !@error.nil?%>
<script>
<%case @error %>
<% when "confirm_password_error"%>
alert('<%=(I18n.locale.to_s=="zh_tw") ? "確認密碼錯誤!" : "Confirm password error!"%>')
<% when "password_all_empty"%>
alert('<%=(I18n.locale.to_s=="zh_tw") ? "新密碼和確認密碼為空!請填入值在這兩個欄位" : "New password and confirm password are empty!Please fill some value in them."%>')
<% when "new_password_empty"%>
alert('<%=(I18n.locale.to_s=="zh_tw") ? "新密碼為空!請填入值在這個欄位" : "New password is empty!Please fill some value in it."%>')
<% when "confirm_password_empty"%>
alert('<%=(I18n.locale.to_s=="zh_tw") ? "確認密碼為空!請填入值在這個欄位" : "Confirm password is empty!Please fill some value in it."%>')
<%end%>
</script>
<%end%>
<script>
$('#submit_button').click(function(){
var error = "",flag = false , new_password = $('#new_password').val(),confirm_password = $('#confirm_password').val();
if(new_password == "" && confirm_password == "")
error = "password_all_empty";
else if(new_password == "")
error = "new_password_empty";
else if(confirm_password == "")
error = "confirm_password_empty";
else if(new_password != confirm_password)
error = "confirm_password_error";
switch (error) {
case "confirm_password_error":
alert('<%=(I18n.locale.to_s=="zh_tw") ? "確認密碼錯誤!" : "Confirm password error!"%>');
break;
case "password_all_empty":
alert('<%=(I18n.locale.to_s=="zh_tw") ? "新密碼和確認密碼為空!請填入值在這兩個欄位" : "New password and confirm password are empty!Please fill some value in them."%>');
break;
case "new_password_empty":
alert('<%=(I18n.locale.to_s=="zh_tw") ? "新密碼為空!請填入值在這個欄位" : "New password is empty!Please fill some value in it."%>');
break;
case "confirm_password_empty":
alert('<%=(I18n.locale.to_s=="zh_tw") ? "確認密碼為空!請填入值在這個欄位" : "Confirm password is empty!Please fill some value in it."%>');
break;
default:
flag = true;
}
return flag;
});
</script>