Send a code for password reset via email - Swift + Firebase - swift

I am creating a simple Swift app. I have got the login working with Swift app. Now, when a user clicks on forgot-password, I want to send them an email with a code. Once he enters that code, he can enter a new password.
I looked up at Firebase.auth.auth() I saw functions like checkActionCode() and applyActionCode() - I couldnot understand a clear difference between them!
I also saw some other functions like confirmpasswordReset() and verifyPasswordResetCode().
However, I do not understand what function to use and how to send an email with the code. Can someone give me an overview of how can I do this? Thank you!

If the user forgot their password, you can send them a password reset email with:
Auth.auth().sendPasswordReset(withEmail: email) { (error) in
// ...
}
This email contains so-called OOB code and a link to an auto-generated page that allows them to reset their password. I recommend getting started with this approach, since you'll have to do the least work to get it up and running.
If you want to create your own page instead of the auto-generated one, have a look at the documentation on custom email action handlers. That page also contains an example showing how to call the handleResetPassword, handleRecoverEmail, and handleVerifyEmail methods.

Related

Thunderbird78+: How to check for message create, reply and forward

I am a beginner in thunderbird addons so I really appreciate if you can help me. I am trying to find a way in my background javascript to check whenever a user has opened the window for create a new message, reply a message and forward a message. I want to put a default text in the message window before the user is gonna send it. I know thunderbird 78+ should only uses web extension APIs and i found this Compose API but how to use it in my background script.
https://thunderbird-webextensions.readthedocs.io/en/78/compose.html
It looks like setComposeDetails() is what you want.
setComposeDetails(tabId, details)
Updates the compose window. Specify only fields that you want to change. Currently only the to/cc/bcc/replyTo/followupTo/newsgroups fields and the subject are implemented.
tabId (integer)
details (ComposeDetails)
I have note tried it, but I suppose that either details.body or details.plainTextBody from the ComposeDetails object can be used to pass the default text you want to use. So I would try something like this in the background script:
let details = {
body: "This is my default text",
};
browser.messages.setComposeDetails(tabId, details);
You might have to combine it with a call to messages.getComposeDetails() if empty fields in details reset the values in the composer window (I don't know).
If you want to call this when the user opens a new compose window, I would look at the window.onCreated event. If you want to do it right before the message is sent instead, you should look at the compose.onBeforeSend event. All of them are described in the API documentation.

MS Bot framework i want to put a form builder in an open conversation

I want to start Form conversation chat in Microsoft Bot framework.
if(user says hello)
{
reply = what u want to listen hi or hello
if(user says order)
{
reply= start a formbuilder.form with order form workflow
}
if(user says hello)
{
reply= hello
}
}
My problem is the first thing i do always works
example: if i say first chat line as order it starts order form but it never goes to the normal conversation mode even if the form ends.
if i start hi then it always goes in hi mode never goes or create order form on typing order.
Need it to be dynamic
you can use below code to end your conversation when you are in a dialog or a conversation flow ends.
context.Done<object>(new object());
or
context.Done(true);
do let me know if you need any help further
Per my understanding, you want start specific dialogs while triggering different words like "hollo" for greeting dialog, "order" for form dialog.
I think there are two methods to achieve this in C#:
You can leverage Recognize intents to implement LUIS, which can identify your users' intent from their spken or textual input, or utterances. Trigger specific dialogs for each LUIS intent.
For this solution you can refer to the official document Recognize intents and entities with LUIS using a prebuilt domain for details, and refer to https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/intelligence-LUIS for a sample for your reference.
You also can build Global message handlers using scorables in your bot application for yourself. With which, you can route users to certain fuctionality by using words like "help," "cancel," or "start over" in the middle of a conversation when the bot is expecting a different response.
Please refer to https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/core-GlobalMessageHandlers for the sample for this solution.
Hope it helps.

Loopback login with phone as username and verification

I've extended the User model in my loopback application, and added phone number as a login method, I use the username field to do this, the only deal is that on login I get the 'email not verified' error, I have my own phoneNumberVerified field, and have overwritten the confirm method to validate the token against the emailVerificationToken and against the phoneNumberVerificationToken and update the corresponding flag, I thought of overwriting the original login method to not allow login only if both emailVerified and phoneNumberVerified fields are false (not just the email) but I don't know how to actually do the login the way loopback does it (I believe it creates an AccessToken or something), and I'm asking for some help on how to do this, thanks XD. I can do the overwriting and validations myself I just need to know how to do the actual login without using the original login method, since I'll be rewriting it.
So I figured out that I actually don't need email or phone number verified validation at all on login (later on the workflow will be required, but that'll be another use case, so it's irrelevant on login to me now XD). So when I was looking on how to overwrite the login method I realized that all the models code it's on the node_modules folder xD
node_modules/loopback/common/models/user.js
And found there in the login method a flag that validates if should check email verified or not, so on my startup script I just put this:
app.models.MyUser.settings.emailVerificationRequired = false;
That stops the email verified validation on login.
And maybe if some of you would like to override the login method I believe copying the whole method from the original user model up there and attaching it to your model and doing some modifications might work xD, it invokes the createAccessToken from the user model (itself) and that's what I believe creates the 'login', what I came to understand is that there is no "session" data, it creates an accesstoken when you successfully login, and as I've been doing just sending the token id to every request 'authenticates' your logged user.
Thanks for reading, have a nice day :)

How to get text from gmail and paste that text in another tab using selenium web driver

I have one test case like,when I forget password in any application like facebook or myAT&T site,i have to click forget password link and then I will enter email and click submit.After that a temporary password is send to the email.My task is that,to get that temporary password and switch to the old tab and paste that text in the temporary password text box.
Is there any solution for this,please help me to solve this.
Thanks in advance,
Santhosh
I'll never do it the way you want to do. Meaning, launching gmail and copying the password from the browser. It consumes more time and i'm not testing gmail. There are two possible solutions I can think of.
In regression environment, set the password generated to a constant value if possible. And use the same in the test. in this approach we are not testing "email send" mechanism of the app, if that is not the intent of the test use this approach. Most simple one.
Use a email client library, they are available in all the languages (eg: https://stackoverflow.com/a/8293945/1520443). Use it to assess the password mail that is sent to your gmail.
Why would you want to open a new tab ? You can create a new instance of the browser,work on it(in your case get the password) and then destroy it.
Having multiple instances will give you more control rather than same instance with multiple tabs (unless you test case really means to do that).

laravel lost password issue

im making an authentification form where i have to add the lost password form so i found a tutorial that im folowing but im not getting the result
http://culttt.com/2013/09/23/password-reminders-reset-laravel-4/
when i enter teh email and press the button
Route::post('password', function()
{
$credentials = array('email' => Input::get('email'));
return Password::remind($credentials);
});
it says that This super simple method uses Laravel’s input reminder functionality to add the email to the reminder table we created earlier and send the email. You might get an exception saying that you haven’t set up your sender address yet. To fix this, go to app/config/mail.php and fill in the relevant details.
but im getting a view with " reminders.user " can someone help :) thx
You are receiving an INVALID_USER message.
Your lang/reminders.php file is not in place, so it is showing the key 'reminders.user' instead of "We can't find a user with that e-mail address.".