roboto-js 1.4.16 → 1.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/rbt_api.cjs +18 -16
- package/dist/esm/rbt_api.js +6 -4
- package/package.json +1 -1
- package/src/rbt_api.js +4 -6
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -138,55 +138,57 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
138
138
|
* @param {Object} params - The login parameters.
|
|
139
139
|
* @param {string} params.email - The email of the user.
|
|
140
140
|
* @param {string} params.password - The password of the user.
|
|
141
|
+
* @param {string} params.code - The password of the user.
|
|
141
142
|
* @returns {Promise<Object>} - The response data from the API.
|
|
142
143
|
*/
|
|
143
144
|
}, {
|
|
144
145
|
key: "login",
|
|
145
146
|
value: (function () {
|
|
146
147
|
var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
147
|
-
var
|
|
148
|
+
var response;
|
|
148
149
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
149
150
|
while (1) switch (_context3.prev = _context3.next) {
|
|
150
151
|
case 0:
|
|
151
152
|
_context3.prev = 0;
|
|
152
|
-
|
|
153
|
-
hash_password = _cryptoJs["default"].MD5(params.password).toString(_cryptoJs["default"].enc.Hex);
|
|
154
|
-
_context3.next = 4;
|
|
153
|
+
_context3.next = 3;
|
|
155
154
|
return this.axios.post('/user_service/loginUser', [{
|
|
156
155
|
email: params.email,
|
|
157
|
-
password:
|
|
158
|
-
|
|
156
|
+
password: params.password ? _cryptoJs["default"].MD5(params.password).toString(_cryptoJs["default"].enc.Hex) : null,
|
|
157
|
+
// legacy hash password (md5)
|
|
158
|
+
passwd: params.password || null,
|
|
159
|
+
// current password
|
|
160
|
+
code: params.code || null // single-use signon code (password resets)
|
|
159
161
|
}]);
|
|
160
|
-
case
|
|
162
|
+
case 3:
|
|
161
163
|
response = _context3.sent;
|
|
162
164
|
if (!(response.data.ok === false)) {
|
|
163
|
-
_context3.next =
|
|
165
|
+
_context3.next = 6;
|
|
164
166
|
break;
|
|
165
167
|
}
|
|
166
168
|
return _context3.abrupt("return", this._handleError(response));
|
|
167
|
-
case
|
|
169
|
+
case 6:
|
|
168
170
|
this.iac_session = response.data;
|
|
169
171
|
this.currentUser = this.iac_session ? new _rbt_user["default"](this.iac_session.user, this.axios) : null;
|
|
170
172
|
// update axios instance headers with authtoken
|
|
171
173
|
this.axios.defaults.headers.common['authtoken'] = response.data.authToken;
|
|
172
174
|
this.authtoken = response.data.authToken;
|
|
173
175
|
if (!this.localStorageAdaptor) {
|
|
174
|
-
_context3.next =
|
|
176
|
+
_context3.next = 13;
|
|
175
177
|
break;
|
|
176
178
|
}
|
|
177
|
-
_context3.next =
|
|
179
|
+
_context3.next = 13;
|
|
178
180
|
return this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
|
|
179
|
-
case
|
|
181
|
+
case 13:
|
|
180
182
|
return _context3.abrupt("return", response.data);
|
|
181
|
-
case
|
|
182
|
-
_context3.prev =
|
|
183
|
+
case 16:
|
|
184
|
+
_context3.prev = 16;
|
|
183
185
|
_context3.t0 = _context3["catch"](0);
|
|
184
186
|
this._handleError(_context3.t0);
|
|
185
|
-
case
|
|
187
|
+
case 19:
|
|
186
188
|
case "end":
|
|
187
189
|
return _context3.stop();
|
|
188
190
|
}
|
|
189
|
-
}, _callee3, this, [[0,
|
|
191
|
+
}, _callee3, this, [[0, 16]]);
|
|
190
192
|
}));
|
|
191
193
|
function login(_x2) {
|
|
192
194
|
return _login.apply(this, arguments);
|
package/dist/esm/rbt_api.js
CHANGED
|
@@ -67,16 +67,18 @@ export default class RbtApi {
|
|
|
67
67
|
* @param {Object} params - The login parameters.
|
|
68
68
|
* @param {string} params.email - The email of the user.
|
|
69
69
|
* @param {string} params.password - The password of the user.
|
|
70
|
+
* @param {string} params.code - The password of the user.
|
|
70
71
|
* @returns {Promise<Object>} - The response data from the API.
|
|
71
72
|
*/
|
|
72
73
|
async login(params) {
|
|
73
74
|
try {
|
|
74
|
-
// create a md5 hash of the password using crypto-js
|
|
75
|
-
const hash_password = CryptoJS.MD5(params.password).toString(CryptoJS.enc.Hex);
|
|
76
75
|
const response = await this.axios.post('/user_service/loginUser', [{
|
|
77
76
|
email: params.email,
|
|
78
|
-
password:
|
|
79
|
-
|
|
77
|
+
password: params.password ? CryptoJS.MD5(params.password).toString(CryptoJS.enc.Hex) : null,
|
|
78
|
+
// legacy hash password (md5)
|
|
79
|
+
passwd: params.password || null,
|
|
80
|
+
// current password
|
|
81
|
+
code: params.code || null // single-use signon code (password resets)
|
|
80
82
|
}]);
|
|
81
83
|
if (response.data.ok === false) {
|
|
82
84
|
return this._handleError(response);
|
package/package.json
CHANGED
package/src/rbt_api.js
CHANGED
|
@@ -75,19 +75,17 @@ export default class RbtApi {
|
|
|
75
75
|
* @param {Object} params - The login parameters.
|
|
76
76
|
* @param {string} params.email - The email of the user.
|
|
77
77
|
* @param {string} params.password - The password of the user.
|
|
78
|
+
* @param {string} params.code - The password of the user.
|
|
78
79
|
* @returns {Promise<Object>} - The response data from the API.
|
|
79
80
|
*/
|
|
80
81
|
async login(params) {
|
|
81
82
|
try {
|
|
82
83
|
|
|
83
|
-
// create a md5 hash of the password using crypto-js
|
|
84
|
-
const hash_password = CryptoJS.MD5(params.password).toString(CryptoJS.enc.Hex);
|
|
85
|
-
|
|
86
|
-
|
|
87
84
|
const response = await this.axios.post('/user_service/loginUser', [{
|
|
88
85
|
email: params.email,
|
|
89
|
-
password:
|
|
90
|
-
passwd: params.password
|
|
86
|
+
password: (params.password)? CryptoJS.MD5(params.password).toString(CryptoJS.enc.Hex): null, // legacy hash password (md5)
|
|
87
|
+
passwd: params.password || null, // current password
|
|
88
|
+
code: params.code || null // single-use signon code (password resets)
|
|
91
89
|
}]);
|
|
92
90
|
|
|
93
91
|
if (response.data.ok === false) {
|