I want users in my app to receive a unique code to their emails upon registration, which they need to enter inside the app in order to confirm their email and login in the app. How can I get this working with Backendless? Some of the things I need are:
The user should be able to ask for the confirmation email to be resend with a new code, making any previously sent codes invalid.
If the user exits the app and then attempts to login, it should not let them and instead redirect them again to the screen for entering a verification code.
The verification code needs to expire after a given period of time if not used.
The verification code should not be used by any other user.
The email sent does not have a verification link, it only provides the code.
Importantly, I need to be able to do all the above using the REST API as I’m using AppGyver to develop the front-end and unfortunately as of now, the JS SDK is not an option.
Implement a method that generates code and associates it with the user in the database, also save the timestamp when the code should expire
The same method from (1) uses email template to send the code to the user.
Implement another method to verify the code. This is the method your app will use when the user puts the code in the app. The method would validate the code to make sure it is not expired and then mark the user that they can login.
Hey Mark, thanks for the response. How would I implement said methods? Is there a tutorial I can get my hands on? I would also prefer to use my own custom code if possible.
Wondering now about the default email confirmation provided by Backendless:
Is there a way to have the confirmation URL open the app if clicked in a mobile device? As in, if the user clicks the link using a device where they have the app installed it opens the app, otherwise it sends them to a web page.
If yes to the above, is there a way to pass custom query parameters in the URL for the app to receive?
What page does the default confirmation URL open? Can this be set to any link? If so, how does Backendless know the user has confirmed their URL?
I do not know, this is something you should research as it is strictly cliend-side functionality.
See the link on email templates I sent in the previous response.
By default it runs the functionality that confirms the user, there is more to it than just a page. The final page the user sees can be configured with UI Builder.
It sounds like the confirmation URL makes an API call to confirm the user, and it can be configured to redirect to another URL (e.g. a page with a thank you message) after it does so. Is this correct? Where do I actually get to specify the URL for this final page?
Hi Mark, is there likewise a tutorial or similar on how to that? And a last question, is it possible to resend the default email confirmation template to the user? I’m thinking in case it doesn’t arrive, it goes to junk and gets deleted, etc.
Great, I will checkout those tutorials. There doesn’t seem to be any documentation on the REST API resendconfirmation endpoint Does it require any body, content headers, etc?
How can I use codeless to detect the user’s device language? I haven’t been able to find a block which does this (similar to the Geolocation one). What I’m trying to do is to detect the user’s device language on page enter event, then render the text dynamically by choosing its content from a page variable using a lookup. Is this possible?
Where no difference what component you chose, you always get a language what prefer user(this is coming from browser settings).
Here is how it looks in default JS code - window.navigator.language
I fully agree with you, if you think it looks a little scary in codeless, so I create a discussion ticket for our developer’s team to implement it in one block. If we found it useful - we add it to codeless.
Regards, Dima.
UPD: The logic for getting this is harder than I think first. Here you can see how to implement it right: