/**
  * Store a newly created session in storage.
  * POST /session
  *
  * @return Response
  */
 public function store()
 {
     // Attempt to login
     try {
         // Login credentials
         $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
         // Authenticate the user
         if (Auth::attempt($credentials)) {
             // Store Session values for user
             Session::put('email', $credentials['email']);
             Session::put('user_id', User::getIdFromEmail($credentials['email']));
             // Redirect to dashboard with message
             Session::flash('alert_success', 'Logged in successfully.');
             return Redirect::intended('dashboard');
         } else {
             Session::flash('alert_warning', 'Unable to login. Please check your username and password, and try again.');
             return Redirect::to(secure_url('/login'))->withInput();
         }
     } catch (\RuntimeException $e) {
         // An unexpected error occurred.
         Log::error(date("Y-m-d H:i:s") . '- RuntimeException in app/contorllers/SessionController: ' . '\\$data = ' . print_r($data) . $e);
         Session::flash('alert_danger', 'An unexpected error occurred.');
         return Redirect::to(secure_url('/login'))->withInput();
     }
 }
Пример #2
0
 public function doLogin()
 {
     // validate the info, create rules for the inputs
     $rules = array('email' => 'required|email', 'password' => 'required|alphaNum|min:3');
     // run the validation rules on the inputs from the form
     $validator = Validator::make(Input::all(), $rules);
     // if the validator fails, redirect back to the form
     if ($validator->fails()) {
         return Redirect::to('login')->withErrors($validator)->withInput(Input::except('password'));
         // send back the input (not the password) so that we can repopulate the form
     } else {
         // create our user data for the authentication
         $userdata = array('email' => Input::get('email'), 'password' => Input::get('password'));
         // attempt to do the login
         if (Auth::attempt($userdata)) {
             // validation successful!
             // redirect them to the secure section or whatever
             // return Redirect::to('secure');
             // for now we'll just echo success (even though echoing in a controller is bad)
             echo 'SUCCESS!';
         } else {
             // validation not successful, send back to form
             return Redirect::to('login');
         }
     }
 }
Пример #3
0
 /**
  * Store a newly created user in storage.
  *
  * @return Response
  */
 public function store()
 {
     // create the validator
     $validator = Validator::make(Input::all(), User::$rules);
     // attempt validation
     if ($validator->fails()) {
         // validation failed, redirect to the index page with validation errors and old inputs
         return Redirect::back()->withInput()->withErrors($validator);
     } else {
         // validation succeeded, create and save the user
         $user = new User();
         $user->first_name = Input::get('first_name');
         $user->last_name = Input::get('last_name');
         $user->username = Input::get('username');
         $user->email = Input::get('email');
         $user->password = Input::get('password');
         $result = $user->save();
         if ($result) {
             Session::flash('successMessage', $user->first_name . ' Thank you for signing up at Park It');
             Auth::attempt(array('email' => $user->email, 'password' => Input::get('password')));
             return Redirect::action('HomeController@showIndex');
         } else {
             Session::flash('errorMessage', 'Please properly input all the required fields');
             Log::warning('Post failed to save: ', Input::all());
             return Redirect::back()->withInput();
         }
     }
 }
Пример #4
0
function againcrazy()
{
    $DEFusername = '******';
    $DEFpassword = '******';
    $username = '';
    $password = '';
    Auth::attempt($username, $password);
    if (Input::has('username') && Input::has('password')) {
        var_dump($test);
        $username = Input::get('username');
        $password = Input::get('password');
        if (Auth::attempt($username, $password)) {
            header('Location: http://codeup.dev/authorized.php');
            exit;
        } else {
            if (Input::get('username') == '' && Input::get('password') == '') {
                echo "please enter a username and password";
            } else {
                echo "that is not the correct username or password";
            }
        }
    }
    // if (isset($_SESSION['logged_in_user']) && $_SESSION['logged_in_user']) {
    // 		header('Location: http://codeup.dev/authorized.php');
    // 		exit;
    // }
    $passme = ['password' => $password, 'username' => $username];
    return $passme;
}
Пример #5
0
    public function dologin()
    {
        $rules = array('username' => 'required', 'password' => 'required');
        $message = array('required' => 'Data :attribute harus diisi', 'min' => 'Data :attribute minimal diisi :min karakter');
        $validator = Validator::make(Input::all(), $rules, $message);
        if ($validator->fails()) {
            return Redirect::to('/')->withErrors($validator)->withInput(Input::except('password'));
        } else {
            $data = array('username' => Input::get('username'), 'password' => Input::get('password'));
            if (Auth::attempt($data)) {
                $data = DB::table('user')->select('user_id', 'level_user', 'username')->where('username', '=', Input::get('username'))->first();
                //print_r($data);
                //echo $data->id_users;
                Session::put('user_id', $data->user_id);
                Session::put('level', $data->level_user);
                Session::put('username', $data->username);
                //print_r(Session::all());
                return Redirect::to("/admin/beranda");
            } else {
                Session::flash('messages', '
					<div class="alert alert-danger alert-dismissable" >
                    		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    		<strong>Peringatan...</strong><br>
                    			Username dan password belum terdaftar pada sistem !
                    		</div>
				');
                return Redirect::to('/')->withInput(Input::except('password'));
            }
        }
    }
Пример #6
0
 /**
  * Log in to site.
  *
  * @return Response
  */
 public function login()
 {
     if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')), true) || Auth::attempt(array('username' => Input::get('email'), 'password' => Input::get('password')), true)) {
         return Redirect::intended('dashboard');
     }
     return Redirect::back()->withInput(Input::except('password'))->with('message', 'Wrong creadentials!');
 }
Пример #7
0
 public function doLogin()
 {
     $rules = array('email' => 'required', 'password' => 'required');
     $allInput = Input::all();
     $validation = Validator::make($allInput, $rules);
     //dd($allInput);
     if ($validation->fails()) {
         return Redirect::route('login')->withInput()->withErrors($validation);
     } else {
         $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
         if (Auth::attempt($credentials)) {
             if (Auth::user()->access_level == '1') {
                 return Redirect::intended('dashboard');
             } elseif (Auth::user()->access_level == '2') {
                 return Redirect::intended('doc_dashboard');
             } elseif (Auth::user()->access_level == '4') {
                 return Redirect::intended('patient_dashboard');
             } else {
                 return Redirect::intended('nurse_dashboard');
             }
         } else {
             return Redirect::route('login')->withInput()->withErrors('Error in Email Address or Password.');
         }
     }
 }
Пример #8
0
 /**
  * Handle authentication attempts
  *
  * @return Response
  */
 public function authenticate()
 {
     if (Auth::attempt(['username' => $username, 'password' => $password])) {
         // Authentication was successful
         return response('Authentication successful', 200);
     }
 }
Пример #9
0
 /**
  *
  * @return nothing
  * @author Tremor
  */
 public function login()
 {
     if (Request::isMethod('post')) {
         $post = Input::all();
         $rules = ['email' => 'required|email', 'password' => 'required'];
         $validator = Validator::make($post, $rules);
         if ($validator->fails()) {
             $this->setMessage($validator->messages()->all(), 'error');
             return Redirect::route('login')->withInput();
         } else {
             $email = trim(Input::get('email'));
             $password = trim(Input::get('password'));
             $remember = Input::get('remember') == 1 ? true : false;
             if (Auth::attempt(array('email' => $email, 'password' => $password, 'is_admin' => 1))) {
                 return Redirect::route('admin');
             } elseif (Auth::attempt(array('email' => $email, 'password' => $password))) {
                 return Redirect::route('home');
             } else {
                 $this->setMessage('failed login', 'error');
                 return Redirect::route('login')->withInput();
             }
         }
     }
     return View::make('auth.signin')->with($this->data);
 }
 public function processLogin()
 {
     $validator = Validator::make(array('email' => Input::get('email'), 'password' => Input::get('password')), array('email' => 'required', 'password' => 'required'));
     $email = Input::get('email');
     $password = Input::get('password');
     if ($validator->fails()) {
         $errors = $validator->messages()->all();
         return Redirect::back()->with('flash_errors', $errors);
     } else {
         if (Auth::attempt(array('email' => $email, 'password' => $password))) {
             $user = Auth::user();
             if ($user->role_id == 2) {
                 return Redirect::route('adminDashboard');
             } elseif ($user->role_id == 1) {
                 if ($user->is_activated == 1) {
                     return Redirect::route('moderateDashboard');
                 } else {
                     return Redirect::back()->with('flash_error', "Please activate your account, Check your mail or contact admin");
                 }
             } elseif ($user->role_id == 3) {
                 if ($user->is_activated == 1) {
                     return Redirect::route('contributorDashboard');
                 } else {
                     return Redirect::back()->with('flash_error', "Please activate your account, Check your mail or contact admin");
                 }
             } else {
                 return Redirect::back()->with('flash_error', "something went wrong");
             }
         } else {
             return Redirect::back()->with('flash_error', "Invalid Email and Password");
         }
     }
 }
 public function doRegister()
 {
     $username = Input::get('username');
     $password = Input::get('password');
     $password = Hash::make($password);
     if ($username != "" && $password != "") {
         $users = User::all();
         $usernames = array();
         foreach ($users as $user) {
             $usernames[] = $user->username;
         }
         if (!in_array($username, $usernames)) {
             $user = new User();
             $user->username = $username;
             $user->password = $password;
             $user->save();
             $userdata = array('username' => Input::get('username'), 'password' => Input::get('password'));
             if (Auth::attempt($userdata)) {
                 $user = Auth::user();
                 return Response::json(array('error' => false, 'userdata' => $user), 200);
             } else {
                 return Response::json(array('error' => true, 'reason' => 'login failed'), 200);
             }
         } else {
             return Response::json(array('error' => true, 'reason' => 'username not unique'), 200);
         }
     } else {
         return Response::json(array('error' => true, 'reason' => 'username or password is empty'), 200);
     }
 }
Пример #12
0
 public function login()
 {
     /*  $user = array(
             'name'  => Input::get('name'),
             'surname'      => Input::get('surname'),
             'mail'      => Input::get('mail'),
             'username'      => Input::get('username'),
             'password'      => Input::get('password'),
             're-password'      => Input::get('re-password')
         );*/
     $gelen = Input::all();
     // Kurallar
     $rules = array('mail' => 'required|min:8|max:60', 'password' => 'required|min:8|max:20');
     // Hata mesajları
     $messages = array('mail.required' => 'Email Boş Geçmeyiniz..', 'mail.max' => 'Mail adresiniz azami :max Karakter Olmalıdır.', 'email.min' => 'Mail adresiniz asgari :min Karakter Olmalıdır.', 'password.required' => 'Lütfen Şifre Giriniz.', 'password.max' => 'Şifreniz en fazla :min karakterli olmalıdır.', 'password.min' => 'Şifreniz en az :max karakterli olmalıdır.');
     // Validation
     $validate = Validator::make($gelen, $rules, $messages);
     if ($validate->fails()) {
         return View::make('login.login')->withErrors($validate);
     } else {
         if (Auth::attempt(array('user_mail' => Input::get('mail'), 'password' => Input::get('password')))) {
         }
         if (Auth::check()) {
             return Redirect::to('/');
         } else {
             return View::make('login.login')->with('hata', 'E-mail Veya Şifre Yanlış');
         }
     }
 }
 public function login(Request $data)
 {
     if ($data->isMethod('post')) {
         $email = $data->input('email');
         $password = $data->input('password');
         $result['message'] = NULL;
         if ($email) {
             $obj = new User();
             $checkIfEmailExists = $obj->getUserWhere($email, $password);
             if ($checkIfEmailExists['status'] !== 200) {
                 $result['message'] = $checkIfEmailExists['message'];
                 return view('Auth.login', ['result' => $result]);
             } else {
                 if (Auth::attempt(['email' => $email, 'password' => $password])) {
                     Session::put('email', $email);
                     return redirect()->intended('view');
                 } else {
                     $result['message'] = 'Password Incorrect';
                     return view('Auth.login', ['result' => $result]);
                 }
             }
         } else {
             return view('auth.login', ['result' => $result]);
         }
     }
 }
 public function store()
 {
     $rules = array('name' => 'required|max:200', 'email' => 'required|email|unique:users|max:200|', 'password' => 'required|min:8|max:200');
     $messages = array('email.unique' => "You have already registered with this email address. Sign in <a href=\"/login\">here</a>");
     $input = Input::all();
     $validator = Validator::make($input, $rules, $messages);
     if ($validator->fails()) {
         return Redirect::to('signup')->withInput()->withErrors($validator);
     } else {
         $password = Hash::make($input['password']);
         //Validation passed -- Make a new user in the DB
         $user = new User();
         $user->name = $input['name'];
         $user->password = $password;
         $user->email = $input['email'];
         $user->isActive = 1;
         $user->save();
         //Here we will send an email with the link to confirm .... https://github.com/Zizaco/confide
         //We'll send the user an email thanking them for registering
         $attempt = Auth::attempt(array('email' => $input['email'], 'password' => $input['password']));
         if ($attempt) {
             return Redirect::to('dashboard')->with('flash_message_good', 'Welcome to Open Source Collaborative Consumption Marketplace. You have been successfully signed up and logged in!');
         } else {
             Log::error('Trying to log user in straight after register failed. User redirected to login page');
             return Redirect::to('login')->with('flash_message_good', "Your signup has been successfull, go ahead and log in here!");
         }
     }
 }
Пример #15
0
function userCheck($username, $password)
{
    $log = new Log("log");
    $array = fileOpen();
    print_r($array);
    $true = false;
    $_SESSION['is-logged-in'] = $true;
    for ($i = 0; $i < count($array); $i++) {
        if (Auth::attempt($username, $password, $array[$i]["password"])) {
            $true = true;
            $log->logMessage("SWEET", "That password for {$username} was correct!, Logging {$username} in!");
            $sessionuname = $array[$i]["username"];
            $_SESSION["username"] = $sessionuname;
            break;
        } else {
            $true = false;
            $log->logMessage("HEY!", "That password for {$username} was incorrect!");
            $sessionuname = "Guest";
            $_SESSION["username"] = $sessionuname;
        }
    }
    if ($true == true) {
        return "You did it {$sessionuname}!";
    } else {
        return "You didn't say the magic word!";
    }
}
 /**
  * Display customer login screen.
  * 
  * @return Response
  */
 public function login()
 {
     if (Auth::check()) {
         return Redirect::route('profile');
     } elseif (Request::isMethod('post')) {
         $loginValidator = Validator::make(Input::all(), array('email' => 'required', 'password' => 'required'));
         if ($loginValidator->passes()) {
             $inputCredentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
             if (Auth::attempt($inputCredentials)) {
                 $customer = Customer::find(Auth::id());
                 if ($customer->admin_ind) {
                     Session::put('AdminUser', TRUE);
                 }
                 if (is_null($customer->address)) {
                     // If customer does not have address, redirect to create address.
                     return Redirect::route('customer.address.create', Auth::id())->with('message', 'No address found for account.  Please enter a valid address.');
                 }
                 return Redirect::intended('profile')->with('message', 'Login successful.');
             }
             return Redirect::back()->withInput()->withErrors(array('password' => array('Credentials invalid.')));
         } else {
             return Redirect::back()->withInput()->withErrors($loginValidator);
         }
     }
     $this->layout->content = View::make('customers.login');
 }
Пример #17
0
 public function postSignin()
 {
     if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')))) {
         return Redirect::to('/')->with('message', 'thanks for signing in');
     }
     return Redirect::to('users/signin')->with('message', 'your email/password combo was incorrect');
 }
Пример #18
0
 public function auth()
 {
     if (Auth::attempt(Input::except('_token'))) {
         return Redirect::route('home');
     }
     return Redirect::route('signin')->with('error', Lang::get('user.signin.error'))->withInput();
 }
Пример #19
0
 public function postLogin()
 {
     // Get all the inputs
     // id is used for login, username is used for validation to return correct error-strings
     $userdata = array('id' => Input::get('username'), 'username' => Input::get('username'), 'password' => Input::get('password'));
     // Declare the rules for the form validation.
     $rules = array('username' => 'Required', 'password' => 'Required');
     // Validate the inputs.
     $validator = Validator::make($userdata, $rules);
     // Check if the form validates with success.
     if ($validator->passes()) {
         // remove username, because it was just used for validation
         unset($userdata['username']);
         // Try to log the user in.
         if (Auth::attempt($userdata)) {
             // Redirect to homepage
             return Redirect::to('')->with('success', 'You have logged in successfully');
         } else {
             // Redirect to the login page.
             return Redirect::to('login')->withErrors(array('password' => 'Password invalid'))->withInput(Input::except('password'));
         }
     }
     // Something went wrong.
     return Redirect::to('login')->withErrors($validator)->withInput(Input::except('password'));
 }
Пример #20
0
 public function postLogin()
 {
     if (Auth::attempt(Input::only('email', 'password'), TRUE)) {
         return Auth::user();
     }
     return Response::make(['message' => 'Wrong credentials'], 500);
 }
Пример #21
0
 public function postLogin()
 {
     if (Request::ajax()) {
         $userdata = array('usuario' => Input::get('usuario'), 'password' => Input::get('password'));
         if (Auth::attempt($userdata, Input::get('remember', 0))) {
             //buscar los permisos de este usuario y guardarlos en sesion
             $query = "SELECT m.nombre as modulo, s.nombre as submodulo,\n                        su.agregar, su.editar, su.eliminar,\n                        CONCAT(m.path,'.', s.path) as path, m.icon\n                        FROM modulos m \n                        JOIN submodulos s ON m.id=s.modulo_id\n                        JOIN submodulo_usuario su ON s.id=su.submodulo_id\n                        WHERE su.estado = 1 AND m.estado = 1 AND s.estado = 1\n                        and su.usuario_id = ?\n                        ORDER BY m.nombre, s.nombre ";
             $res = DB::select($query, array(Auth::id()));
             $menu = array();
             $accesos = array();
             foreach ($res as $data) {
                 $modulo = $data->modulo;
                 //$accesos[] = $data->path;
                 array_push($accesos, $data->path);
                 if (isset($menu[$modulo])) {
                     $menu[$modulo][] = $data;
                 } else {
                     $menu[$modulo] = array($data);
                 }
             }
             $usuario = Usuario::find(Auth::id());
             Session::set('language', 'Español');
             Session::set('language_id', 'es');
             Session::set('menu', $menu);
             Session::set('accesos', $accesos);
             Session::set('perfilId', $usuario['perfil_id']);
             Session::set("s_token", md5(uniqid(mt_rand(), true)));
             Lang::setLocale(Session::get('language_id'));
             return Response::json(array('rst' => '1', 'estado' => Auth::user()->estado));
         } else {
             $m = '<strong>Usuario</strong> y/o la <strong>contraseña</strong>';
             return Response::json(array('rst' => '2', 'msj' => 'El' . $m . 'son incorrectos.'));
         }
     }
 }
 /**
  * Store a newly created resource in storage.
  * POST /sessions
  *
  * @return Response
  */
 public function store()
 {
     if (Auth::attempt(Input::only('email', 'password'))) {
         return Redirect::to('/reservation');
     }
     return Redirect::back();
 }
Пример #23
0
 /**
  * Verify the user's data for login
  *
  * @return void
  */
 public function login()
 {
     // Get the login form data using the 'Input' class
     $userdata = array('user' => trim(strtolower(Input::get('user_email'))), 'password' => Input::get('user_password'));
     $user = BlockedUser::where('user', $userdata['user'])->first();
     if (isset($user->_id)) {
         $datebegin = new DateTime(date('Y-m-d H:i', $user->date->sec));
         $datebegin = $datebegin->diff(new DateTime());
         $minutes = $datebegin->days * 24 * 60;
         $minutes += $datebegin->h * 60;
         $minutes += $datebegin->i;
         if ($minutes > 30) {
             $user->delete();
         } else {
             return Redirect::back()->withErrors(array('error' => Lang::get('login.attemp') . ' [' . $user->user . '] ' . Lang::get('login.blocked') . (30 - $minutes) . Lang::get('login.minute')));
         }
     }
     //checks if the user wants to be remembered
     $isAuth = Input::get('check_user') === 'yes' ? Auth::attempt($userdata, true) : Auth::attempt($userdata);
     // Try to authenticate the credentials
     if ($isAuth) {
         if (Session::has($userdata['user'])) {
             Session::forget($userdata['user']);
         }
         return Redirect::to(Lang::get('routes.' . Auth::user()->rank));
     } else {
         return $this->validateUser($userdata['user']);
     }
 }
Пример #24
0
 public function login()
 {
     //Reglas
     $rules = array('iCorreo' => 'required|regex:/^([a-zA-Z0-9])+@espoch.edu.ec/', 'iPassword' => 'required');
     //Mensajes
     $messages = array('required' => 'El campo :attribute es obligatorio', 'correo' => 'El campo :attribute debe ser un email institucional');
     $validation = Validator::make(Input::all(), $rules, $messages);
     if ($validation->fails()) {
         return Redirect::to(URL::previous())->withInput()->withErrors($validation);
     } else {
         $credenciales = array('correo_usuario' => e(Input::get('iCorreo')), 'password' => e(Input::get('iPassword')));
         if (Auth::attempt($credenciales)) {
             $id = Auth::User()->id;
             $user = User::find($id);
             $user->estado_usuario = 1;
             $user->save();
             switch (Auth::User()->tipo_usuario) {
                 case 1:
                     return Redirect::to('/administrador/index');
                     break;
                 case 2:
                     return Redirect::to('/moderador/index');
                     break;
                 case 3:
                     return Redirect::to('/usuarios/index');
                     break;
             }
         } else {
             return Redirect::to(URL::previous())->with('mensaje', 'Credenciales Inválidas');
         }
     }
 }
Пример #25
0
 public function store()
 {
     if (Auth::attempt(Input::only('username', 'password'))) {
         return Redirect::route('users.show', Auth::user()->username);
     }
     return Redirect::back()->withInput()->withErrors(array('password' => 'Invalid Password or username'));
 }
 public function postLogin()
 {
     //Retrieve POST values
     $email = Input::get('email');
     $password = Input::get('password');
     $previous_page = Input::get('previous_page');
     $user_details = Input::all();
     //Rules for login form submission
     $rules = array('email' => 'required', 'password' => 'required');
     $validation = Validator::make($user_details, $rules);
     //Validate input against rules
     if ($validation->fails()) {
         return Response::json(array('status' => 'error', 'errors' => $validation->messages()->getMessages()));
     }
     //Check that the user account exists
     $user = User::where('email', $email)->first();
     if (!isset($user)) {
         return Response::json(array('status' => 'error', 'errors' => array('No such user')));
     }
     //If the user's token field isn't blank, he/she hasn't confirmed their account via email
     if ($user->token != '') {
         return Response::json(array('status' => 'error', 'errors' => array('Please click the link sent to your email to verify your account.')));
     }
     //Attempt to log user in
     $credentials = array('email' => $email, 'password' => $password);
     if (Auth::attempt($credentials)) {
         return Response::json(array('status' => 'ok', 'errors' => array()));
     } else {
         return Response::json(array('status' => 'error', 'errors' => array('The email address or password is incorrect.')));
     }
 }
Пример #27
0
 public function postSignIn()
 {
     $email = Input::get('email');
     $password = Input::get('password');
     $remember = Input::get('remember_me');
     $validation = new SeatUserValidator();
     if ($validation->passes()) {
         // Check if we got a username or email for auth
         $identifier = filter_var(Input::get('email'), FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
         // Attempt authentication using a email address
         if (Auth::attempt(array($identifier => $email, 'password' => $password), $remember ? true : false)) {
             // If authentication passed, check out if the
             // account is activated. If it is not, we
             // just logout again.
             if (Auth::User()->activated) {
                 return Redirect::back()->withInput();
             } else {
                 // Inactive account means we will not keep this session
                 // logged in.
                 Auth::logout();
                 // Return the session back with the error. We are ok with
                 // revealing that the account is not active as the
                 // credentials were correct.
                 return Redirect::back()->withInput()->withErrors('This account is not active. Please ensure that you clicked the activation link in the registration email.
                     ');
             }
         } else {
             return Redirect::back()->withErrors('Authentication failure');
         }
     }
     return Redirect::back()->withErrors($validation->errors);
 }
 public function post_profile($table, $col_name, $type)
 {
     $this->object = database::get_instance();
     $users = DB::table('users_login')->orderBy('id', 'desc')->first();
     $stu_id = $users->user_session;
     $id = $this->object->view($table, "where_pluck", $col_name, '=', $stu_id, 'id');
     $profile_image = $this->object->view($table, "where_pluck", 'id', '=', $id, 'profile_image');
     Session::put('table', $table);
     if (Auth::attempt(array('password' => Input::get('old_pass')))) {
         if (Input::get('new_pass') == Input::get('pass_confirm')) {
             $this->add_file = $this->object->upload_file('profile_images', $table, 'upload', 'profile_image', "update", 'id', $id, $profile_image);
             $val = array('password' => Hash::make(Input::get('new_pass')));
             $this->object->update($table, 'id', $id, $val);
         } else {
             $return = Redirect::to('profile=' . $type)->with('exists', 'Please Enter Correct new password');
         }
     } else {
         $return = Redirect::to('profile=' . $type)->with('exists', 'Please Enter Correct Old password');
     }
     if ($this->add_file) {
         $return = Redirect::to('profile=' . $type)->with('success', 'You successfully Update Your Profile.');
     } else {
         $return = Redirect::to('profile=' . $type)->with('exists', 'Please Select a file');
     }
     return $return;
 }
Пример #29
0
 public function postIndex()
 {
     if (\Auth::attempt(array('email' => \Input::get('email'), 'password' => \Input::get('password')))) {
         return \Redirect::intended('/');
     }
     return \Redirect::to('/?errors=true');
 }
Пример #30
0
 public function signin()
 {
     $json_request = array('status' => FALSE, 'responseText' => '', 'responseErrorText' => '', 'redirect' => FALSE);
     if (Request::ajax()) {
         $rules = array('login' => 'required', 'password' => 'required|alpha_num|between:6,50');
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->passes()) {
             if (Auth::attempt(array('email' => Input::get('login'), 'password' => Input::get('password'), 'active' => 1), (bool) Input::get('remember'))) {
                 if (Auth::check()) {
                     #$json_request['redirect'] = link::auth(AuthAccount::getStartPage());
                     #$redirect = link::auth();
                     $redirect = AuthAccount::getGroupStartUrl();
                     $json_request['redirect'] = $redirect;
                     $json_request['status'] = TRUE;
                 }
             } else {
                 $json_request['responseText'] = 'Неверное имя пользователя или пароль';
             }
         } else {
             $json_request['responseText'] = 'Неверно заполнены поля';
             $json_request['responseErrorText'] = $validator->messages()->all();
         }
     } else {
         return App::abort(404);
     }
     return Response::json($json_request, 200);
 }