update orders email and updated auth alerts
This commit is contained in:
@@ -1,33 +1,42 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Auth;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Traits\CaptchaTrait;
|
||||
use App\User;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CustomAuthController extends Controller {
|
||||
class CustomAuthController extends Controller
|
||||
{
|
||||
use CaptchaTrait;
|
||||
|
||||
public function authenticate(Request $request){
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
|
||||
$post = $request->all();
|
||||
$email = $post['email'];
|
||||
$password = $post['password'];
|
||||
|
||||
if (Auth::attempt(['email' => $email, 'password' => $password])){
|
||||
if (Auth::attempt(['email' => $email, 'password' => $password])) {
|
||||
|
||||
if (Auth::user()->role == 'admin') {
|
||||
// $message = '
|
||||
// <div class="alert alert-danger alert-dismissible">
|
||||
// <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
// <h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
||||
// You are not allowed to enter to this site.
|
||||
// </div>';
|
||||
$message = '
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
||||
You are not allowed to enter to this site.
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<strong>Error!</strong> You are not allowed to enter to this site.
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>';
|
||||
return response()->json(array('success' => false, 'message'=>$message));
|
||||
return response()->json(array('success' => false, 'message' => $message));
|
||||
}
|
||||
|
||||
|
||||
@@ -37,29 +46,38 @@ class CustomAuthController extends Controller {
|
||||
|
||||
return response()->json(array(
|
||||
'success' => true,
|
||||
'message'=>$message,
|
||||
'navbar'=>$navbar,
|
||||
'message' => $message,
|
||||
'navbar' => $navbar,
|
||||
'save_design_button' => $save_design_button
|
||||
));
|
||||
}else{
|
||||
} else {
|
||||
|
||||
// $message = '
|
||||
// <div class="alert alert-danger alert-dismissible">
|
||||
// <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
// <h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
||||
// Username or Password is incorrect.
|
||||
// </div>';
|
||||
|
||||
$message = '
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
||||
Username or Password is incorrect.
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<strong>Error!</strong> Username or Password is incorrect.
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>';
|
||||
|
||||
return response()->json(array('success' => false, 'message'=>$message));
|
||||
return response()->json(array('success' => false, 'message' => $message));
|
||||
}
|
||||
}
|
||||
|
||||
public function postRegister(Request $request){
|
||||
public function postRegister(Request $request)
|
||||
{
|
||||
$post = $request->all();
|
||||
|
||||
$post['captcha'] = $this->captchaCheck();
|
||||
|
||||
$validator = Validator::make($post, [
|
||||
$validator = Validator::make(
|
||||
$post,
|
||||
[
|
||||
'username' => 'unique:user_logins',
|
||||
'email' => 'unique:user_logins',
|
||||
'g-recaptcha-response' => 'required',
|
||||
@@ -68,22 +86,28 @@ class CustomAuthController extends Controller {
|
||||
[
|
||||
'g-recaptcha-response.required' => 'Captcha is required',
|
||||
'captcha.min' => 'Wrong captcha, please try again.'
|
||||
]);
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
if ($validator->fails()) {
|
||||
$errors = "";
|
||||
foreach($validator->errors()->all() as $error){
|
||||
$errors .= "<li>".$error."</li>";
|
||||
foreach ($validator->errors()->all() as $error) {
|
||||
$errors .= "<li>" . $error . "</li>";
|
||||
}
|
||||
|
||||
// $message = '
|
||||
// <div class="alert alert-danger alert-dismissible">
|
||||
// <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
// <h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
||||
// ' . $errors .
|
||||
// '</div>';
|
||||
$message = '
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
||||
'.$errors.
|
||||
'</div>';
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<strong>Error!</strong>' . $errors .
|
||||
'<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>';
|
||||
|
||||
|
||||
return response()->json(array(
|
||||
'success' => false,
|
||||
@@ -105,5 +129,4 @@ class CustomAuthController extends Controller {
|
||||
'success' => true
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -380,9 +380,9 @@ class PaypalController extends Controller
|
||||
|
||||
if ($other_email[0] != null) {
|
||||
$other_email = implode(", ", $other_email);
|
||||
$email_cc = "orders@crewsportswear.com" . "," . $other_email;
|
||||
$email_cc = "orders@merchbay.com" . "," . $other_email;
|
||||
} else {
|
||||
$email_cc = "orders@crewsportswear.com";
|
||||
$email_cc = "orders@merchbay.com";
|
||||
}
|
||||
|
||||
$explode_other_email = explode(",", $email_cc);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col col-lg-5">
|
||||
<div id="register-response-msg"></div>
|
||||
<form role="form" id="frm-register">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||
<div class="mb-3">
|
||||
|
||||
Reference in New Issue
Block a user