summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-04-27 10:55:03 -0400
committerJoram Wilander <jwawilander@gmail.com>2017-04-27 10:55:03 -0400
commit9a87bb3af68216b53ee8f89d6604c715c7b85b2d (patch)
tree8c06aed890f388b228f3aefb8e398309bc73c0b9 /webapp
parent0e007e344bf10993529711f14c4168365c3504c3 (diff)
downloadchat-9a87bb3af68216b53ee8f89d6604c715c7b85b2d.tar.gz
chat-9a87bb3af68216b53ee8f89d6604c715c7b85b2d.tar.bz2
chat-9a87bb3af68216b53ee8f89d6604c715c7b85b2d.zip
Creating common token store and moving email invites and verification to it (#6213)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/actions/user_actions.jsx9
-rw-r--r--webapp/client/client.jsx8
-rw-r--r--webapp/components/do_verify_email.jsx3
-rw-r--r--webapp/components/password_reset_form.jsx2
-rw-r--r--webapp/tests/client/client_user.test.jsx3
5 files changed, 11 insertions, 14 deletions
diff --git a/webapp/actions/user_actions.jsx b/webapp/actions/user_actions.jsx
index c4e0f4fc6..aa43dafda 100644
--- a/webapp/actions/user_actions.jsx
+++ b/webapp/actions/user_actions.jsx
@@ -655,10 +655,9 @@ export function updatePassword(userId, currentPassword, newPassword, success, er
);
}
-export function verifyEmail(uid, hid, success, error) {
+export function verifyEmail(token, success, error) {
Client.verifyEmail(
- uid,
- hid,
+ token,
(data) => {
if (success) {
success(data);
@@ -672,9 +671,9 @@ export function verifyEmail(uid, hid, success, error) {
);
}
-export function resetPassword(code, password, success, error) {
+export function resetPassword(token, password, success, error) {
Client.resetPassword(
- code,
+ token,
password,
() => {
browserHistory.push('/login?extra=' + ActionTypes.PASSWORD_CHANGE);
diff --git a/webapp/client/client.jsx b/webapp/client/client.jsx
index 697687a5f..2b149e240 100644
--- a/webapp/client/client.jsx
+++ b/webapp/client/client.jsx
@@ -1319,19 +1319,19 @@ export default class Client {
this.trackEvent('api', 'api_channels_set_active', {channel_id: id});
}
- verifyEmail(uid, hid, success, error) {
+ verifyEmail(token, success, error) {
request.
- post(`${this.getUsersRoute()}/verify_email`).
+ post(`${this.url}/api/v4/users/email/verify`).
set(this.defaultHeaders).
type('application/json').
accept('application/json').
- send({uid, hid}).
+ send({token}).
end(this.handleResponse.bind(this, 'verifyEmail', success, error));
}
resendVerification(email, success, error) {
request.
- post(`${this.getUsersRoute()}/resend_verification`).
+ post(`${this.url}/api/v4/users/email/verify/send`).
set(this.defaultHeaders).
type('application/json').
accept('application/json').
diff --git a/webapp/components/do_verify_email.jsx b/webapp/components/do_verify_email.jsx
index 9065e6bc4..eeb22e4a8 100644
--- a/webapp/components/do_verify_email.jsx
+++ b/webapp/components/do_verify_email.jsx
@@ -21,8 +21,7 @@ export default class DoVerifyEmail extends React.Component {
}
componentWillMount() {
verifyEmail(
- this.props.location.query.uid,
- this.props.location.query.hid,
+ this.props.location.query.token,
() => {
browserHistory.push('/login?extra=verified&email=' + encodeURIComponent(this.props.location.query.email));
},
diff --git a/webapp/components/password_reset_form.jsx b/webapp/components/password_reset_form.jsx
index 0d67eb786..546dce1b3 100644
--- a/webapp/components/password_reset_form.jsx
+++ b/webapp/components/password_reset_form.jsx
@@ -43,7 +43,7 @@ class PasswordResetForm extends React.Component {
});
resetPassword(
- this.props.location.query.code,
+ this.props.location.query.token,
password,
() => {
this.setState({error: null});
diff --git a/webapp/tests/client/client_user.test.jsx b/webapp/tests/client/client_user.test.jsx
index d10ad6ef0..480d7df10 100644
--- a/webapp/tests/client/client_user.test.jsx
+++ b/webapp/tests/client/client_user.test.jsx
@@ -656,12 +656,11 @@ describe('Client.User', function() {
TestHelper.basicClient().enableLogErrorsToConsole(false); // Disabling since this unit test causes an error
TestHelper.basicClient().verifyEmail(
'junk',
- 'junk',
function() {
done.fail(new Error('should be invalid'));
},
function(err) {
- expect(err.id).toBe('api.context.invalid_param.app_error');
+ expect(err.id).toBe('api.context.invalid_body_param.app_error');
done();
}
);