fix: update password API mapping for /update-password
This commit is contained in:
parent
16e96b14f8
commit
e0d9cf50df
1 changed files with 18 additions and 15 deletions
|
|
@ -9,7 +9,7 @@
|
|||
<span class='indicator blue password-box'>{{ _("Reset Password") if frappe.db.get_default('company') else _("Set Password")}}</span>
|
||||
</div>
|
||||
<form id="reset-password">
|
||||
<div class="form-group">
|
||||
<div class="form-group" style="display: none;">
|
||||
<input id="old_password" type="password"
|
||||
class="form-control" placeholder="{{ _("Old Password") }}">
|
||||
</div>
|
||||
|
|
@ -32,8 +32,8 @@
|
|||
<script>
|
||||
|
||||
frappe.ready(function() {
|
||||
if(frappe.utils.get_url_arg("key")) {
|
||||
$("#old_password").parent().toggle(false);
|
||||
if(!frappe.utils.get_url_arg("key")) {
|
||||
$("#old_password").parent().toggle();
|
||||
}
|
||||
|
||||
if(frappe.utils.get_url_arg("password_expired")) {
|
||||
|
|
@ -57,12 +57,10 @@ frappe.ready(function() {
|
|||
}
|
||||
|
||||
if(!args.old_password && !args.key) {
|
||||
frappe.msgprint("{{ _('Old Password Required.') }}");
|
||||
return;
|
||||
frappe.msgprint(__("Old Password Required."));
|
||||
}
|
||||
if(!args.new_password) {
|
||||
frappe.msgprint("{{ _('New Password Required.') }}");
|
||||
return;
|
||||
frappe.msgprint(__("New Password Required."));
|
||||
}
|
||||
frappe.call({
|
||||
type: "POST",
|
||||
|
|
@ -71,19 +69,24 @@ frappe.ready(function() {
|
|||
args: args,
|
||||
statusCode: {
|
||||
401: function() {
|
||||
$('.page-card-head .indicator').removeClass().addClass('indicator red')
|
||||
.text("{{ _('Invalid Password') }}");
|
||||
$(".page-card-head .indicator").removeClass().addClass("indicator red").text(__("Invalid Password"));
|
||||
},
|
||||
410: function({ responseJSON }) {
|
||||
const title = __("Invalid Link");
|
||||
const message = responseJSON.message;
|
||||
$(".page-card-head .indicator").removeClass().addClass("indicator grey").text(title);
|
||||
frappe.msgprint({ title: title, message: message, clear: true });
|
||||
},
|
||||
200: function(r) {
|
||||
$("input").val("");
|
||||
strength_indicator.addClass('hidden');
|
||||
strength_message.addClass('hidden');
|
||||
$('.page-card-head .indicator')
|
||||
.removeClass().addClass('indicator blue')
|
||||
.html("{{ _('Status Updated') }}");
|
||||
strength_indicator.addClass("hidden");
|
||||
strength_message.addClass("hidden");
|
||||
$(".page-card-head .indicator")
|
||||
.removeClass().addClass("indicator blue")
|
||||
.html(__("Status Updated"));
|
||||
if(r.message) {
|
||||
frappe.msgprint({
|
||||
message: `{{ _('${r.message}') }}`,
|
||||
message: __("Password Updated"),
|
||||
// password is updated successfully
|
||||
// clear any server message
|
||||
clear: true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue