MCPcopy Index your code
hub / github.com/parse-community/parse-server / verifyEmail

Method verifyEmail

src/Controllers/UserController.js:63–98  ·  view source on GitHub ↗
(token)

Source from the content-addressed store, hash-verified

61 }
62
63 async verifyEmail(token) {
64 if (!this.shouldVerifyEmails) {
65 // Trying to verify email when not enabled
66 // TODO: Better error here.
67 throw undefined;
68 }
69
70 const query = { _email_verify_token: token };
71 const updateFields = {
72 emailVerified: true,
73 _email_verify_token: { __op: 'Delete' },
74 };
75
76 // if the email verify token needs to be validated then
77 // add additional query params and additional fields that need to be updated
78 if (this.config.emailVerifyTokenValidityDuration) {
79 query.emailVerified = false;
80 query._email_verify_token_expires_at = { $gt: Parse._encode(new Date()) };
81
82 updateFields._email_verify_token_expires_at = { __op: 'Delete' };
83 }
84 const maintenanceAuth = Auth.maintenance(this.config);
85 const restQuery = await RestQuery({
86 method: RestQuery.Method.get,
87 config: this.config,
88 auth: maintenanceAuth,
89 className: '_User',
90 restWhere: query,
91 });
92
93 const result = await restQuery.execute();
94 if (result.results.length) {
95 query.objectId = result.results[0].objectId;
96 }
97 return await rest.update(this.config, maintenanceAuth, '_User', query, updateFields);
98 }
99
100 async checkResetTokenValidity(token) {
101 const results = await this.config.database.find(

Callers

nothing calls this directly

Calls 3

RestQueryFunction · 0.85
executeMethod · 0.80
updateMethod · 0.80

Tested by

no test coverage detected