You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to keep track of a discussion with @jsheely and @emazzu on gitter: the doc should be enhanced regarding the usage of the user.verify() method.
People who are not aware of this quite recent feature could keep validating the user's email by using a temp AccessToken instance token, as in the resetPassword listener. This draws a security risk as such a token could be used to perform Rest requests.
Making the doc more complete on this part will help preventing developers from implementing the wrong scenario.
Thanks @ebarault can you please provide some references for this new feature? Or some other info that we can use to write the doc? An example is always a good start :-)
Actually i helped a couple of developers in gitter by going through the code in user.js... 😕
here are some excerpts:
Missing in the doc (raw wording)
user.verify() method generates a token that is directly attached to the user instance itself. Using such a token is required rather than creating some custom logic relying on a AccessToken instance belonging to the user, as using the latter represents a security risk: this type of token allows to perform any rest requests authorized to the user. (should be wrapped in a warning or important alert)
The example already referenced in the doc this is a good starting point.
Missing in the doc (which features an example with jade templates)
In case the user is using the jade template proposed in the example for the verify page, then the following lines should be added in app.js, this is missing in the doc.
@bajtos : side note: considering that the default template references the verify.ejs template here shouldn't a project bootstrapped with the cli already have these lines in app.js + the verify.ejs / verified.ejs templates + a default redirect route pointing the /verified, making the feature really available OOTB?
OK, thanks for the info. I'll work on adding this asap. Unfortunately, I'm overbooked with other work atm... If you want to tackle docs, that would be great. Otherwise, I'll get to it as time permits.
considering that the default template references the verify.ejs template here shouldn't a project bootstrapped with the cli already have these lines in app.js + the verify.ejs / verified.ejs templates + a default redirect route pointing the /verified, making the feature really available OOTB?
Activity
crandmck commentedon Mar 15, 2017
Thanks @ebarault can you please provide some references for this new feature? Or some other info that we can use to write the doc? An example is always a good start :-)
ebarault commentedon Mar 17, 2017
Actually i helped a couple of developers in gitter by going through the code in user.js... 😕
here are some excerpts:
Missing in the doc (raw wording)
user.verify() method generates a token that is directly attached to the user instance itself. Using such a token is required rather than creating some custom logic relying on a AccessToken instance belonging to the user, as using the latter represents a security risk: this type of token allows to perform any rest requests authorized to the user.
(should be wrapped in a warning or important alert)
The example already referenced in the doc this is a good starting point.
the following section shows a couple of additional info
Missing in the doc (which features an example with jade templates)
In case the user is using the jade template proposed in the example for the verify page, then the following lines should be added in app.js, this is missing in the doc.
Also a
/verifiedview/page+route should be created in the context of this example.A route should accordingly be created by adding this to the app.js
@bajtos : side note: considering that the default template references the
verify.ejstemplate here shouldn't a project bootstrapped with the cli already have these lines in app.js + the verify.ejs / verified.ejs templates + a default redirect route pointing the /verified, making the feature really available OOTB?Missing in the doc
The template for the verify page can be customized using the
templateoption, see https://github.com/strongloop/loopback/blob/master/common/models/user.js#L414In order to customize the verification mail sent: a
templateFnoption is available, see strongloop/loopback#2937crandmck commentedon Mar 17, 2017
OK, thanks for the info. I'll work on adding this asap. Unfortunately, I'm overbooked with other work atm... If you want to tackle docs, that would be great. Otherwise, I'll get to it as time permits.
Thanks again.
bajtos commentedon Mar 20, 2017
That would be great!
dhmlau commentedon Apr 26, 2022
Since LoopBack 3 has reached end-of-life, closing this issue.