| 37105 |
amit |
1 |
<section class="wrapper">
|
|
|
2 |
<div class="row">
|
|
|
3 |
<div class="col-lg-12">
|
|
|
4 |
<h3 class="page-header"><i class="icon_document_alt"></i>RESET PASSWORD</h3>
|
|
|
5 |
<ol class="breadcrumb">
|
|
|
6 |
<li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
|
|
|
7 |
<li><i class="icon_document_alt"></i>Reset Password (Non-Prod)</li>
|
|
|
8 |
</ol>
|
|
|
9 |
</div>
|
|
|
10 |
</div>
|
|
|
11 |
<div class="container">
|
|
|
12 |
<div class="row">
|
|
|
13 |
<div class="col-lg-4">
|
|
|
14 |
<label>Reset For</label>
|
|
|
15 |
<div class="form-group">
|
|
|
16 |
<select class="form-control" id="resetType">
|
|
|
17 |
<option value="AUTH_USER">Auth User (Employee)</option>
|
|
|
18 |
<option value="PARTNER">Partner</option>
|
|
|
19 |
</select>
|
|
|
20 |
</div>
|
|
|
21 |
|
|
|
22 |
<div id="authUserBlock">
|
|
|
23 |
<label>Email or Mobile</label>
|
|
|
24 |
<div class="form-group">
|
|
|
25 |
<input type="text" class="form-control" placeholder="Employee email or mobile" id="identifier" autocomplete="off">
|
|
|
26 |
</div>
|
|
|
27 |
</div>
|
|
|
28 |
|
|
|
29 |
<div id="partnerBlock" style="display:none;">
|
|
|
30 |
<label>Partner Name</label>
|
|
|
31 |
<div class="form-group">
|
|
|
32 |
<input type="text" class="typeahead form-control" placeholder="Search Partner" id="typeaheadpartner" name="partner" data-provide="typeahead" autocomplete="off">
|
|
|
33 |
<input type="hidden" id="retailerId" value="0">
|
|
|
34 |
<small id="selectedPartnerLabel" style="color:#22c55e;"></small>
|
|
|
35 |
</div>
|
|
|
36 |
</div>
|
|
|
37 |
|
|
|
38 |
<label>New Password</label>
|
|
|
39 |
<div class="form-group pass_show">
|
|
|
40 |
<input type="password" class="form-control" placeholder="New Password" id="newPassword">
|
|
|
41 |
</div>
|
|
|
42 |
<label>Confirm Password</label>
|
|
|
43 |
<div class="form-group pass_show">
|
|
|
44 |
<input type="password" class="form-control" placeholder="Confirm Password" id="confirmPassword">
|
|
|
45 |
</div>
|
|
|
46 |
<div class="form-group">
|
|
|
47 |
<input type="button" class="btn btn-primary reset-password-override" value="Reset Password">
|
|
|
48 |
</div>
|
|
|
49 |
</div>
|
|
|
50 |
</div>
|
|
|
51 |
</div>
|
|
|
52 |
</section>
|
|
|
53 |
|
|
|
54 |
<script type="text/javascript">
|
|
|
55 |
$(function () {
|
|
|
56 |
$('#resetType').off('change.resetpwd').on('change.resetpwd', function () {
|
|
|
57 |
if ($(this).val() === 'PARTNER') {
|
|
|
58 |
$('#partnerBlock').show();
|
|
|
59 |
$('#authUserBlock').hide();
|
|
|
60 |
} else {
|
|
|
61 |
$('#partnerBlock').hide();
|
|
|
62 |
$('#authUserBlock').show();
|
|
|
63 |
}
|
|
|
64 |
});
|
|
|
65 |
|
|
|
66 |
getPartnerAheadOptions($('#typeaheadpartner'), function (selectedPartner) {
|
|
|
67 |
$('#retailerId').val(selectedPartner.partnerId);
|
|
|
68 |
$('#selectedPartnerLabel').text('Selected: ' + selectedPartner.displayName + ' (id ' + selectedPartner.partnerId + ')');
|
|
|
69 |
});
|
|
|
70 |
|
|
|
71 |
$(document).off('click.resetpwd', '.reset-password-override').on('click.resetpwd', '.reset-password-override', function () {
|
|
|
72 |
var type = $('#resetType').val();
|
|
|
73 |
var newPassword = $('#newPassword').val();
|
|
|
74 |
var confirmPassword = $('#confirmPassword').val();
|
|
|
75 |
|
|
|
76 |
if (!newPassword) {
|
|
|
77 |
alert('Please enter a new password');
|
|
|
78 |
return;
|
|
|
79 |
}
|
|
|
80 |
if (newPassword !== confirmPassword) {
|
|
|
81 |
alert('Passwords do not match');
|
|
|
82 |
return;
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
var params = {"type": type, "newPassword": newPassword};
|
|
|
86 |
if (type === 'PARTNER') {
|
|
|
87 |
var retailerId = $('#retailerId').val();
|
|
|
88 |
if (!retailerId || retailerId === '0') {
|
|
|
89 |
alert('Please select a partner from the suggestions');
|
|
|
90 |
return;
|
|
|
91 |
}
|
|
|
92 |
params.retailerId = retailerId;
|
|
|
93 |
} else {
|
|
|
94 |
var identifier = $('#identifier').val();
|
|
|
95 |
if (!identifier) {
|
|
|
96 |
alert('Please enter an email or mobile');
|
|
|
97 |
return;
|
|
|
98 |
}
|
|
|
99 |
params.identifier = identifier;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
doPostAjaxRequestWithParamsHandler(context + "/resetPasswordOverride", params, function (response) {
|
|
|
103 |
alert('Password reset successfully');
|
|
|
104 |
$('#newPassword').val('');
|
|
|
105 |
$('#confirmPassword').val('');
|
|
|
106 |
});
|
|
|
107 |
});
|
|
|
108 |
});
|
|
|
109 |
</script>
|