Laravel 5.4 How to reset password with sms and notifications - laravel

I have see some articles, didn't find the solution.
I know Laravel 5.4's notifications have sms via Nexmo. And Nexmo is a third party website, one sms cost €0.0442 in my country.
But we have our own sms provider, and I had make it work. Our users have to provide real name, email, mobilephone. And the mobilephone have to be verified. I wrote a simple function to do it, with the provider's api.
I would like to implement the laravel notifications, make passwords reset via sms, like emails. How to do this?

The laravel password reset logic can be found in:
vendor/laravel/framework/src/Illuminate/Foundation/Auth/SendsPasswordResetEmails.php.
You can override the functions in there to accomodate for your sms needs.
But since that file is in the vendor folder you have/need to add the functions to:
app/Http/Controllers/Auth/ForgotPasswordController.php
(functions in the ForgotPasswordController override functions in SendsPasswordResetEmails)

Laravel has built in feature for resetting password via email, you can get lot of tutorials in this regards moreover if you want to create for sms validation then you will need a table which will hold the PIN (Personal Identification Number) for particular user, so suppose you have a table named password_pin you need to have columns with users_id, pin, validated_at, Now once you send a sms you can insert the data into these table and while verifying you can place updated with the validated at, you need to have logic where you want to have PIN to be validated once or can be verified more than once. As the validation happens you can show a form for updating the password and can update the password through those.
Note: You can must have a logic of validation in mind to conclude the architecture.
It will be more easier for us to guide you if you provide us the code. Hope this helps.

Related

Saving data in parse to a not yet existing user

I am new at programming. I am building sort of like an chat app and I am using Parse as a backend. I want to make it possible for an existing user to send a message to a non existing user if the user knows the non existing-users email. The non-existing user will then get notified by the app on his email that this person send him a message and that he needs to sign up to read the message, and here is the question:
Does Parse makes it possible to chain this message to the non-existing users email, so that when he signs up in the app with this specific email the specific message to this email will display?
Thanks in advance.
No, not exactly.
You can create the user with the appropriate e-mail address and a made up password. Once that user exists (and hence is saved) you can start to associate things with it. After that you can send an e-mail to the prospective new user allowing them to complete the registration (this is basically a password reset).

Joomla 2.5 - RSForm! PRO Email Submission Based on User

I have this scenario in mind:
I would like to implement the form in such a way that it sends the form to different email addresses based on User.
Scenario:
User A sends Form X to Email Address 1
User B sends Form X to Email Address 2
User C sends Form X to Email Address 3
I can used {global:fullname} to capture the logged in user. Currently, I have a set of list (dropdown) for users to choose the email address to send to. It does not look professional and I intend to change the workflow.
Any help or assistance is greatly appreciated.
Thank you.
RSForm PRO is a very powerful forum builder. It allows you to add code to your forms to manipulate the behavior of the form.
In this post http://www.itoctopus.com/how-to-easily-create-notification-emails-for-form-submissions-in-rsform , we explain how to create a notification email. You will need to take the code in the post, and then, based on the logged in user, you modify the $mailer->addRecipient('[our-client-email]'); code in order to send the email to the appropriate user. Of course, you will need to make some other minor changes, but you get the point.
Hope this helps!

Get user email in windows 10 universal app

I am trying to build a control that the user can use to send feedback to developer. I am using email as a delivery method and I leverage sendgrid email service for this. Now I want to know the users email address so I can respond back to the user's concern. I am not sure how to get the user's email in window 10. Any help or pointers please?
I would strongly recommend to use the sharing approach that has been introduced with Windows 8 - instead of writing and maintaining your own mail functionality and trying to access additional user data.
Have a look at the existing and built in e-mail functionalities. They make use of the user's connected mail accounts and the mail app. This way you don't need to worry about handling the message transmission or anything but rather hand the information over to the mail client. This way you also know how to reply back.
And as a bonus, the user can still access their message via the Sent Mails folder :)
There is a specific class for that, the EmailMessageClass (https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.email.emailmessage.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1) as well as a dedicated guide with code example.
https://msdn.microsoft.com/en-us/library/windows/apps/mt269391.aspx
Essentially you can prepopulate the Mail fields with necessary app information where applicable. The user gets to choose which accounts he wants to send the mail from, but it will open in the mail client.

Approval link in email body

Need help in implementing email based approval system. Ex: Manager gets an auto triggered mail for his/her approval with a approval link in email body, when the manager clicks on the the link, it should validate the manager and then approve it. I tried searching on the internet but didn't find relevant resource.
Request you to Please help me with your ideas, suggestions or how I should proceed, or any plugin or jar is available??? It would be very helpful to me... Thanking you...
EDIT: Thanking you for replying. We have a java web app build using spring framework (MVC) where in employees can apply leaves which has to be approved by his/her manager. If an employee applies leave then a mail is triggered for approval to his/her manager with the leave details. After looking the mail, the manager logs-in to the application to approve or reject the leaves. So request you to Please help me in how to give a direct link in the mail to approve or reject the leaves.
For one of our applications we had the same requirements - employees can submit vacation requests and supervisors will be notified via mail. We have written an article about the exact way we did it - available here.
So in a nutshell, we are using Spring Integration and GMail. Each new vacation request yields an email send to all supervisors. Supervisors can reply with either approve or reject. We only accept email addresses from our domain, but since these can be faked we introduced a shared secret - a UUID added to the mail's subject which then relates to the id of the vacation request.
Once an email comes in we run the business logic to figure out whether a request shall be approved or rejected.
As I stated in my comment, I used Velocity to template my email message. You don't have to use it, but it made my job easier. You should be able to read up on it.
Java itself has the ability to send emails in it's Java EE framework using JavaMail, or you can use Spring's wrappers. You will need access to a mail server of some sorts, and would highly recommend that you setup an email box specifically for this process. I actually used my gmail account during testing, but I wouldn't recommend that for a long-term solution. I assume your company would have an email server setup somewhere you can use.
The process flow would be:
Employee fills out request
System generates an email to employee's manager(s) with a link to approve
Manager clicks on link, taken to approval page
Manager approves/denies request
The next question is how to build the URL. I would suggest using something like a UUID or something like that, or the request ID if that makes it easier. You can generate a UUID from any seed String or set of bytes. I like UUID because it obviscates the data being sent.
Anyway, the URL will basically point to a Spring form that will allow the user to approve that request. So, thinking about what you would need, I would expect some DB record that relates the information in the incoming request to the time off request that was filled out. Read in the record, load the page and display it. Simple enough.
The next issue is locking it down so only the authorized people can approve. Again, making a huge assumption here, but I am guessing you are using Spring Security? If you are, you should be able to add a condition to the Controller's handler for this approval form that requires the user to be authenticated (read here) and add a java.security.Principal to the handler methods arguments (read 15.3.2.3 here for what you can pass into a Controller's handler). With the Principal object in-hand, you should be able to compare that to a list of approvers associated with the request record in the DB. I would then have the system generate approval/denial emails that code to all concerned parties.
Let me reiterate that this is NOT the only solution, only one possible solution. This is why I feel this is not a good question for StackOverflow, as it asks a very broad question that doesn't really have a single right answer.

MVC: Where to trigger user registration emails

I am building an MVC application (using the Zend Framework).
When users first register, the applicaiton sends them an email. My question is, where should I trigger this email from? The model or the controller? My thoughts are as follows:
In some ways, the model makes sense, since sending a registration email is part of my business logic. Users must click the link in the mail to validate their email address.
But by putting it in the model, I am 'encumbering' the model. The model's registerUser action is then only useful within the context of an application that needs emails sent for every registration.
Instead, by triggering the email from within the controller, my controller would be a litter 'fatter', but my model a little more 'fine grained'.
I have written an email service which actually configures and sends the email, and I think this is a good design decision. I am really just asking where I should be calling this service from.
Your thoughts are most appreciated!
According to Zend Framework's definition of MVC, you should put send the email from the controller:
Controllers...decide which view to display based on the user's request.
Models, on the other hand, contain:
...basic functionality behind a set of abstractions.
An email may be considered a "view" in that it displays information to the user. It is the controller's job to activate this "view."
In my opinion, I would want this in the model, as I would consider this an assumed process of the create user method, rather than any specific interaction with the user making the request.
In other words, since I would always want this email sent, regardless of the source of the request, I would identify this as a natural byproduct of the create user action, similar to a record being saved in a database.
You might want to look into using something like NServiceBus to queue messages to be sent to your Email Service.
This way you can have NServiceBus subscribe to an event that occurs and omit any manual firing of the email service etc.
Ultimately you want a failsafe way of ensuring your messages get to the intended people. This kind of framework will greatly help you ensure that this happens.
Alternatively you could store the emails to be sent inside your database and have your email service check the database queue every x minutes for new emails to send and omit the need for triggering the email sending.
Again, doing it this way will ensure at the least that the emails get sent. Should the network go down or some other disruption occur during the sending of each email you can simply leave them in the queue until the network comes back up.

Resources