forked from s421507/eOSP2
Naprawa przekierowania + edytowanie strazakow
This commit is contained in:
commit
e00f575f94
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Input;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\User;
|
use App\User;
|
||||||
|
use Mail;
|
||||||
use App\Rules\Pesel;
|
use App\Rules\Pesel;
|
||||||
|
|
||||||
/* 'phoneNumber' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:9' */
|
/* 'phoneNumber' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:9' */
|
||||||
@ -39,6 +41,9 @@ class RegistrationController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
$request = request();
|
$request = request();
|
||||||
|
|
||||||
|
$confirmation_code = str_random(30);
|
||||||
|
|
||||||
$user = User::create([
|
$user = User::create([
|
||||||
'password' => $request-> password,
|
'password' => $request-> password,
|
||||||
'email' => $request-> email,
|
'email' => $request-> email,
|
||||||
@ -48,13 +53,45 @@ class RegistrationController extends Controller
|
|||||||
'phoneNumber' => $request-> phoneNumber,
|
'phoneNumber' => $request-> phoneNumber,
|
||||||
'functionID' => 1,
|
'functionID' => 1,
|
||||||
'degreeID' => 1,
|
'degreeID' => 1,
|
||||||
'number' => 'ABC123'
|
'number' => 'ABC123',
|
||||||
|
'confirmation_code' => $confirmation_code
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Mail::send('emails.verify', compact('confirmation_code'), function($message) {
|
||||||
|
$message->to(Input::get('email'), Input::get('name'))->subject('Weryfikacja adresu e-mail');
|
||||||
|
});
|
||||||
|
|
||||||
|
//Flash::message('Thanks for signing up! Please check your email.');
|
||||||
|
|
||||||
|
|
||||||
auth()->login($user);
|
auth()->login($user);
|
||||||
|
|
||||||
return redirect()->to('/jednostka');
|
return redirect()->to('/jednostka');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function confirm($confirmation_code)
|
||||||
|
{
|
||||||
|
if( ! $confirmation_code)
|
||||||
|
{
|
||||||
|
throw new InvalidConfirmationCodeException;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = User::whereConfirmationCode($confirmation_code)->first();
|
||||||
|
|
||||||
|
if ( ! $user)
|
||||||
|
{
|
||||||
|
throw new InvalidConfirmationCodeException;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->confirmed = 1;
|
||||||
|
$user->confirmation_code = null;
|
||||||
|
$user->email_verified_at = now();
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
//Flash::message('You have successfully verified your account.');
|
||||||
|
|
||||||
|
return redirect()->to('/jednostka');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ class fireFightersController extends Controller
|
|||||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
||||||
// $users = user::where("fireStationID", auth()->user()->fireStationID)->get();
|
// $users = user::where("fireStationID", auth()->user()->fireStationID)->get();
|
||||||
$users = DB::table('users')->where("fireStationID", '=', auth()->user()->fireStationID)->get();
|
$users = DB::table('users')->where("fireStationID", '=', auth()->user()->fireStationID)->get();
|
||||||
|
echo "<script type='text/javascript'>alert('test');</script>";
|
||||||
return view("fireFighters", ["users" => $users]);
|
return view("fireFighters", ["users" => $users]);
|
||||||
} else{
|
} else{
|
||||||
return view('fireFighters');
|
return view('fireFighters');
|
||||||
@ -28,7 +29,7 @@ class fireFightersController extends Controller
|
|||||||
$fireStation = fireStation::find(auth()->user()->fireStationID);
|
$fireStation = fireStation::find(auth()->user()->fireStationID);
|
||||||
if($fireStation-> creatorID == auth()->user()->id){
|
if($fireStation-> creatorID == auth()->user()->id){
|
||||||
return view('fireFightersAdd');
|
return view('fireFightersAdd');
|
||||||
} else return view("fireFighters");
|
} else return fireFightersController::create();
|
||||||
} else return view("unit");
|
} else return view("unit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +85,7 @@ class fireFightersController extends Controller
|
|||||||
'changingID' => auth()->user()-> id
|
'changingID' => auth()->user()-> id
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return view('fireFighters');
|
return fireFightersController::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,12 +51,17 @@ class fireStationController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
$request = request();
|
$request = request();
|
||||||
|
|
||||||
|
$voivodeship = DB::table('wojewodztwa')->select('name')->where('id', $request -> voivodeship)->first();
|
||||||
|
$county = DB::table('powiaty')->select('name')->where('id', $request -> county)->first();
|
||||||
|
$community = DB::table('gminy')->select('name')->where('id', $request -> community)->first();
|
||||||
|
|
||||||
$jednostka = fireStation::create([
|
$jednostka = fireStation::create([
|
||||||
'name' => $request -> unitName,
|
'name' => $request -> unitName,
|
||||||
'number' => $request -> number,
|
'number' => $request -> number,
|
||||||
'voivodeship' => $request -> voivodeship,
|
'voivodeship' => $voivodeship -> name,
|
||||||
'county' => $request -> county,
|
'county' => $county -> name,
|
||||||
'community' => $request -> community,
|
'community' => $community -> name,
|
||||||
'postOffice' => $request -> postOffice,
|
'postOffice' => $request -> postOffice,
|
||||||
'zipCode' => $request -> zipCode,
|
'zipCode' => $request -> zipCode,
|
||||||
'address' => $request -> address,
|
'address' => $request -> address,
|
||||||
|
@ -18,7 +18,7 @@ class User extends Authenticatable
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name', 'surname', 'password', 'PESEL', 'phoneNumber', 'email', 'fireStationID', 'functionID', 'degreeID', 'number', 'statusID', 'deleted', 'creatorID', 'changingID',
|
'name', 'surname', 'password', 'PESEL', 'phoneNumber', 'email', 'fireStationID', 'functionID', 'degreeID', 'number', 'statusID', 'deleted', 'creatorID', 'changingID', 'confirmation_code',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
'host' => env('MAIL_HOST', 'mailtrap.io'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -42,7 +42,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'port' => env('MAIL_PORT', 587),
|
'port' => env('MAIL_PORT', 2525),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -29,6 +29,8 @@ class CreateUsersTable extends Migration
|
|||||||
$table->integer('deleted')->default(0);
|
$table->integer('deleted')->default(0);
|
||||||
$table->integer('creatorID')->nullable()->default(null);
|
$table->integer('creatorID')->nullable()->default(null);
|
||||||
$table->integer('changingID')->nullable()->default(null);
|
$table->integer('changingID')->nullable()->default(null);
|
||||||
|
$table->boolean('confirmed')->default(0);
|
||||||
|
$table->string('confirmation_code')->nullable();
|
||||||
$table->timestamp('email_verified_at')->nullable();
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
$table->rememberToken();
|
$table->rememberToken();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
17
resources/views/emails/verify.blade.php
Normal file
17
resources/views/emails/verify.blade.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en-US">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>Weryfikacja adresu e-mail</h2>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
Dziękujemy za utworzenie konta w serwisie eOSP. Proszę kliknąć w link poniżej by dokonać weryfikacji adresu e-mail {{ URL::to('register/verify/' . $confirmation_code) }}<br/>
|
||||||
|
|
||||||
|
W razie problemów proszę wkleić powyższy link w polu adresowym przeglądarki internetowej.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -57,6 +57,11 @@ Route::get('/jednostka/getcounties/{id}','DataController@getCounties');
|
|||||||
Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities');
|
Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities');
|
||||||
|
|
||||||
|
|
||||||
|
Route::get('register/verify/{confirmationCode}', [
|
||||||
|
'as' => 'confirmation_path',
|
||||||
|
'uses' => 'RegistrationController@confirm'
|
||||||
|
]);
|
||||||
|
|
||||||
//Auth::routes();
|
//Auth::routes();
|
||||||
//
|
//
|
||||||
//Route::get('/home', 'HomeController@index')->name('home');
|
//Route::get('/home', 'HomeController@index')->name('home');
|
||||||
|
Loading…
Reference in New Issue
Block a user