Send Hash in the e-mail and confirm in the form

Asked

Viewed 149 times

1

I would like to make a system that works like this: For the student to confirm the proof visa, he would have to receive a hash code in his email. If he doesn’t know the code, he would have to put the proof code and the secret answer (reset the one he registered in the register), paste this code into the form field and when he confirms, in the evidence table would appear his Visa. My teacher had to change schools and I’m doubting how to do that.

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • Hard to deizer without knowing what you have already done. Manages to elaborate a [mcve]?

1 answer

0

Opa friend, as your doubt is very comprehensive I believe you want to just a way to go, so here are some tips:

When registering students and schools, a hash should be generated, logically this hash should be unique, because as it will be serialized (sent by email), it should be sha1 and not Encrypt ex:

sha1($request->input('id_escola') . $request->input('email'). config(''));

Next you should create a notification structure look at the documentation of the Laravel

php artisan make:notification NotificacaoAluno

Register in the Trap mail to test the upload

.env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

In control the sending method would look something like this:

foreach($alunos as $aluno)
   Notification::route('mail', $aluno->email)->notify(new NotificacaoAluno($aluno));

A to close the cycle need to create the published route that will receive these tokens:

Route::get('/provas/{tokenescola}/{tokenaluno}', 'AtividadeController@mostraProvas');

Att

Browser other questions tagged

You are not signed in. Login or sign up in order to post.