Commit f272ceac authored by joelalju's avatar joelalju
Browse files

[#136] Settings' warning messages updated.

parent 120d99e1
......@@ -127,3 +127,6 @@ msgstr "Contrasenya massa petita"
msgid "Password fields aren't equal"
msgstr "Els camps de la contrasenya no son iguals"
msgid "Some of the password's fields are empty"
msgstr "Algún dels camps de la contrasenya és buida"
......@@ -127,3 +127,6 @@ msgstr ""
msgid "Password fields aren't equal"
msgstr ""
msgid "Some of the password's fields are empty"
msgstr ""
......@@ -127,3 +127,6 @@ msgstr "Contraseña demasiado pequeña"
msgid "Password fields aren't equal"
msgstr "Los campos de la contraseña no son iguales"
msgid "Some of the password's fields are empty"
msgstr "Algunos de los campos de la contraseña están vacíos"
......@@ -499,28 +499,35 @@ sub user_settings {
my $changed_lang;
my $changed_pass;
if ($c->req->method('POST')) {
$USER->language($c->param('tongue'));
$changed_lang = $c->param('tongue');
_logged_in($c);
$USER->language($c->param('tongue'));
$changed_lang = $c->param('tongue');
_logged_in($c);
}
warn $c->param('button_click');
$c->param('tongue' => $USER->language);
my @errors;
if (!($c->param('password') eq "") || !($c->param('conf_password') eq "")) {
if ($c->param('password') eq $c->param('conf_password')) {
eval {
$USER->change_password($c->param('password'));
_logged_in($c);
};
if ($@ =~ /Password too small/) {
push @errors,("Password too small")
}
else {$changed_pass = 1;};
}
else {
push @errors,("Password fields aren't equal")
}
if ($c->param('button_click')) {
if (($c->param('password') eq "") || ($c->param('conf_password') eq "")) {
push @errors,("Some of the password's fields are empty");
}
else {
if ($c->param('password') eq $c->param('conf_password')) {
eval {
$USER->change_password($c->param('password'));
_logged_in($c);
};
if ($@ =~ /Password too small/) {
push @errors,("Password too small")
}
else {
$changed_pass = 1;
};
}
else {
push @errors,("Password fields aren't equal")
}
}
}
$c->render(template => 'bootstrap/user_settings', changed_lang=> $changed_lang, changed_pass => $changed_pass
,errors =>\@errors);
};
......
......@@ -12,36 +12,36 @@
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="text-center"><%=l 'Settings' %></h2>
% if (scalar @$errors) {
<div class="panel panel-danger">
<div class="panel-heading">
% for (@$errors) {
<%= $_ %>
% }
</div>
</div>
% if (scalar @$errors) {
<div class="panel panel-danger">
<div class="panel-heading">
% for (@$errors) {
<%= $_ %>
% }
</div>
</div>
% }
<p><form method='post' enctype="multipart/form-data">
<%=l 'Language:' %> <select onchange="this.form.submit();" id="tongue" name="tongue" >
<option <%= $c->param("tongue") eq 'en' ? "selected" : "" %> value="en" ><%=l 'English' %></option>
<option <%= $c->param("tongue") eq 'es' ? "selected" : "" %> value="es" ><%=l 'Spanish' %></option>
<option <%= $c->param("tongue") eq 'ca' ? "selected" : "" %> value="ca" ><%=l 'Catalan' %></option>
<option <%= $c->param("tongue") eq 'en' ? "selected" : "" %> value="en" ><%=l 'English' %></option>
<option <%= $c->param("tongue") eq 'es' ? "selected" : "" %> value="es" ><%=l 'Spanish' %></option>
<option <%= $c->param("tongue") eq 'ca' ? "selected" : "" %> value="ca" ><%=l 'Catalan' %></option>
</select>
% if ($changed_lang) {
<font color="green"> <%=l 'Your language has been changed successfully' %></font>
% }
% if ($changed_lang) {
<font color="green"> <%=l 'Your language has been changed successfully' %></font>
% }
</form>
</p>
<p>____<p></br>
<form method='post' enctype="multipart/form-data">
<p><%=l 'New Password:' %><input type= 'password' name= 'password' id='password'></p>
<p><%=l 'Confirm Password:' %><input type='password' name='conf_password' id='conf_password'></p>
<p><input type='submit' onclick='this.form.submit();' id='button_click' name='button_click' value='<%=l 'Submit' %>'></input>
% if ($changed_pass) {
<font color="green"> <%=l 'Your password has been changed successfully' %></font>
% }
% if ($changed_pass) {
<font color="green"> <%=l 'Your password has been changed successfully' %></font>
% }
</p>
</form>
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment