V
V
Voll.2016-06-23 23:22:57
Laravel
Voll., 2016-06-23 23:22:57

How to combine the Authorization\Registration\Password Recovery system in Laravel 5.2?

There is a standard Laravel 5.2 authorization system.
There is a form

<form action="{{ url('/login') }}" method="post">
        <fieldset>
            <div class="container-form">
                <h3>Войдите или зарегистрируйтесь</h3>
                <a href="#" title="tt close" class="close-popup"><strong><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16.63 17.06"><title>close</title><path class="close-svg" d="M15.3,17.06l-7-7.16-7,7.16L0,15.73l6.95-7.2L0,1.4,1.26,0l7,7.16,7-7.2,1.33,1.33-7,7.2,7,7.2Z" style="fill:#ffffff"/></svg></strong></a>
                <div class="field-row">
                    <input name="email" type="email" value="{{ old('email') }}" class="text {{ $errors->has('email') ? ' error-input' : '' }} " id="field4" placeholder="E-mail">
                </div>
                <div class="field-row">
                    <input name="password" type="password" value="" class="text {{ $errors->has('password') ? ' error-input' : '' }}" id="field2" placeholder="Пароль">
                </div>
                <div class="row-checkbox">
                    <input type="checkbox" class="checkbox" id="field3" name="remember">
                    <label name="Remember" for="field3">Запомнить меня</label>
                </div>
                <div class="row-buttons">
                    <button type="submit" name="enter" class="button">Вход</button>
                    <button type="submit" name="register" class="button">Регистрация</button>
                </div>
                <div class="row-buttons">
                    <button type="submit" name="forgot" class="button">Забыли пароль!!?</button>
                </div>
                {{csrf_field()}}
            </div>
        </fieldset>
    </form>

It has 3 buttons with different name. How can it be combined so that when the request arrives, it does what is indicated in name.
When registering - registered, with a password.
At authorization - authorized and sent mail.
When restoring - sent an email with a link.
I'm interested in exactly how to combine all this, since the typical laravel authorization system does this with different controllers and traits, which implies sending and processing requests with different routes.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2016-06-24
@Nc_Soft

Make js handlers for each button.

N
Nikolai Shvetsov, 2016-06-24
@ShNn

Add hidden field with name and handle it in controller?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question