| 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>
|
| 37127 |
amit |
51 |
|
|
|
52 |
<hr/>
|
|
|
53 |
<div class="row">
|
|
|
54 |
<div class="col-lg-6">
|
|
|
55 |
<h4>Bulk (dev/staging only)</h4>
|
|
|
56 |
<p style="color:#94a3b8;font-size:12px;">Download the current test-updated passwords (cleartext), edit the <b>Password</b> column, and re-upload to apply. Columns: Type | Id | Identifier | Password.</p>
|
|
|
57 |
<div class="form-group">
|
|
|
58 |
<a href="${rc.contextPath}/authUser/passwordOverride/download" class="btn btn-default">Download overrides (.xlsx)</a>
|
|
|
59 |
</div>
|
|
|
60 |
<div class="form-group">
|
|
|
61 |
<input type="file" id="overrideFile" accept=".xlsx">
|
|
|
62 |
</div>
|
|
|
63 |
<div class="form-group">
|
|
|
64 |
<input type="button" class="btn btn-primary upload-password-overrides" value="Upload & Apply">
|
|
|
65 |
</div>
|
|
|
66 |
</div>
|
|
|
67 |
</div>
|
| 37105 |
amit |
68 |
</div>
|
|
|
69 |
</section>
|
|
|
70 |
|
|
|
71 |
<script type="text/javascript">
|
|
|
72 |
$(function () {
|
|
|
73 |
$('#resetType').off('change.resetpwd').on('change.resetpwd', function () {
|
|
|
74 |
if ($(this).val() === 'PARTNER') {
|
|
|
75 |
$('#partnerBlock').show();
|
|
|
76 |
$('#authUserBlock').hide();
|
|
|
77 |
} else {
|
|
|
78 |
$('#partnerBlock').hide();
|
|
|
79 |
$('#authUserBlock').show();
|
|
|
80 |
}
|
|
|
81 |
});
|
|
|
82 |
|
|
|
83 |
getPartnerAheadOptions($('#typeaheadpartner'), function (selectedPartner) {
|
|
|
84 |
$('#retailerId').val(selectedPartner.partnerId);
|
|
|
85 |
$('#selectedPartnerLabel').text('Selected: ' + selectedPartner.displayName + ' (id ' + selectedPartner.partnerId + ')');
|
|
|
86 |
});
|
|
|
87 |
|
|
|
88 |
$(document).off('click.resetpwd', '.reset-password-override').on('click.resetpwd', '.reset-password-override', function () {
|
|
|
89 |
var type = $('#resetType').val();
|
|
|
90 |
var newPassword = $('#newPassword').val();
|
|
|
91 |
var confirmPassword = $('#confirmPassword').val();
|
|
|
92 |
|
|
|
93 |
if (!newPassword) {
|
|
|
94 |
alert('Please enter a new password');
|
|
|
95 |
return;
|
|
|
96 |
}
|
|
|
97 |
if (newPassword !== confirmPassword) {
|
|
|
98 |
alert('Passwords do not match');
|
|
|
99 |
return;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
var params = {"type": type, "newPassword": newPassword};
|
|
|
103 |
if (type === 'PARTNER') {
|
|
|
104 |
var retailerId = $('#retailerId').val();
|
|
|
105 |
if (!retailerId || retailerId === '0') {
|
|
|
106 |
alert('Please select a partner from the suggestions');
|
|
|
107 |
return;
|
|
|
108 |
}
|
|
|
109 |
params.retailerId = retailerId;
|
|
|
110 |
} else {
|
|
|
111 |
var identifier = $('#identifier').val();
|
|
|
112 |
if (!identifier) {
|
|
|
113 |
alert('Please enter an email or mobile');
|
|
|
114 |
return;
|
|
|
115 |
}
|
|
|
116 |
params.identifier = identifier;
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
doPostAjaxRequestWithParamsHandler(context + "/resetPasswordOverride", params, function (response) {
|
|
|
120 |
alert('Password reset successfully');
|
|
|
121 |
$('#newPassword').val('');
|
|
|
122 |
$('#confirmPassword').val('');
|
|
|
123 |
});
|
|
|
124 |
});
|
| 37127 |
amit |
125 |
|
|
|
126 |
$(document).off('click.pwdbulk', '.upload-password-overrides').on('click.pwdbulk', '.upload-password-overrides', function () {
|
|
|
127 |
var f = $('#overrideFile')[0];
|
|
|
128 |
if (!f || !f.files || !f.files.length) {
|
|
|
129 |
alert('Please choose an .xlsx file to upload');
|
|
|
130 |
return;
|
|
|
131 |
}
|
|
|
132 |
var fd = new FormData();
|
|
|
133 |
fd.append('file', f.files[0]);
|
|
|
134 |
$.ajax({
|
|
|
135 |
url: context + "/authUser/passwordOverride/upload",
|
|
|
136 |
type: 'POST',
|
|
|
137 |
data: fd,
|
|
|
138 |
processData: false,
|
|
|
139 |
contentType: false,
|
|
|
140 |
success: function (response) {
|
|
|
141 |
var msg = response;
|
|
|
142 |
try { var p = JSON.parse(response); msg = (p && p.data) ? p.data : p; } catch (e) {}
|
|
|
143 |
alert(msg || 'Upload processed');
|
|
|
144 |
$('#overrideFile').val('');
|
|
|
145 |
},
|
|
|
146 |
error: function (xhr) {
|
|
|
147 |
alert('Upload failed: ' + (xhr.responseText || xhr.status));
|
|
|
148 |
}
|
|
|
149 |
});
|
|
|
150 |
});
|
| 37105 |
amit |
151 |
});
|
|
|
152 |
</script>
|