public function createParent() { $input = Input::all(); if (Input::hasFile('profilepic')) { $input['profilepic'] = $this->filestore(Input::file('profilepic')); } $input['dob'] = date('Y-m-d H:i:s', strtotime(Input::get('dob'))); $input['collegeid'] = Session::get('user')->collegeid; $input['collegename'] = Admin::where('collegeid', '=', Session::get('user')->collegeid)->first()->collegename; //$input['collegeid']="dummy"; //$input['collegename']="dummy"; $user = new User(); $user->email = $input['email']; $user->password = Hash::make($input['password']); $user->collegeid = $input['collegeid']; $user->flag = 3; $user->save(); $input['loginid'] = $user->id; $removed = array('_token', 'password', 'cpassword'); foreach ($removed as $k) { unset($input[$k]); } Parent::saveFormData($input); return $input; }
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')); } } }
public function update() { if (!$this->app['sentry']->getUser()->hasAccess('superuser')) { return new Response($this->app['translator']->trans('noPermissionsGeneric'), 403); } foreach ($this->input->all() as $name => $value) { $option = $this->setting->where('name', $name)->first(); if ($option) { $this->setting->where('name', $name)->update(array('value' => $value)); } else { $this->setting->insert(array('name' => $name, 'value' => $value)); } } return new Response($this->app['translator']->trans('settingsUpdated'), 201); }
/** * Saves user submissions for Independent Sponsor requests. */ public function putRequest() { //Validate input $rules = array('address1' => 'required', 'city' => 'required', 'state' => 'required', 'postal_code' => 'required', 'phone' => 'required'); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { return Response::json($this->growlMessage($validation->messages()->all(), 'error'), 400); } //Add new user information to their record $user = Auth::user(); $user->address1 = Input::get('address1'); $user->address2 = Input::get('address2'); $user->city = Input::get('city'); $user->state = Input::get('state'); $user->postal_code = Input::get('postal_code'); $user->phone = Input::get('phone'); $user->save(); if (!$user->getSponsorStatus()) { //Add UserMeta request $request = new UserMeta(); $request->meta_key = UserMeta::TYPE_INDEPENDENT_SPONSOR; $request->meta_value = 0; $request->user_id = $user->id; $request->save(); } return Response::json(); }
/** * Unfollow a user * * @param $userIdToUnfollow * @return Response */ public function destroy($userIdToUnfollow) { $input = array_add(Input::all(), 'userId', Auth::id()); $this->execute(UnfollowUserCommand::class, $input); Flash::success("You have now unfollowed this user."); return Redirect::back(); }
public function actionSearchSimple() { $condition = Input::all(); Session::set('conditionSearchSimple', $condition); Session::forget('conditionSearchAdvance'); return Redirect::to('ket-qua-tim-kiem'); }
public function updateProfile() { $name = Input::get('name'); //$username = Input::get('username'); $birthday = Input::get('birthday'); $bio = Input::get('bio', ''); $gender = Input::get('gender'); $mobile_no = Input::get('mobile_no'); $country = Input::get('country'); $old_avatar = Input::get('old_avatar'); /*if(\Cashout\Models\User::where('username',$username)->where('id','!=',Auth::user()->id)->count()>0){ Session::flash('error_msg', 'Username is already taken by other user . Please enter a new username'); return Redirect::back()->withInput(Input::all(Input::except(['_token']))); }*/ try { $profile = \Cashout\Models\User::findOrFail(Auth::user()->id); $profile->name = $name; // $profile->username = $username; $profile->birthday = $birthday; $profile->bio = $bio; $profile->gender = $gender; $profile->mobile_no = $mobile_no; $profile->country = $country; $profile->avatar = Input::hasFile('avatar') ? \Cashout\Helpers\Utils::imageUpload(Input::file('avatar'), 'profile') : $old_avatar; $profile->save(); Session::flash('success_msg', 'Profile updated successfully'); return Redirect::back(); } catch (\Exception $e) { Session::flash('error_msg', 'Unable to update profile'); return Redirect::back()->withInput(Input::all(Input::except(['_token', 'avatar']))); } }
public function postVote() { Input::merge(array_map('trim', Input::all())); $input = Input::all(); $rules = array('MCUsername' => 'required|max:40', 'g-recaptcha-response' => 'required|recaptcha', 'sid' => 'required'); $v = Validator::make($input, $rules); $sid = $input['sid']; $server = DB::table('mcservers')->where('mcs_id', '=', $sid)->first(); if (!count($server)) { return Redirect::to('/minecraft/' . $sid)->withErrors("Ocorreu um erro com a validação do servidor"); } if ($v->passes()) { if (mcservers::playerHasVoted($sid, $input['MCUsername']) || mcservers::ipHasVoted($sid, $_SERVER["HTTP_CF_CONNECTING_IP"])) { return Redirect::to('/minecraft/' . $sid)->withErrors("Já votaste hoje"); } if ($server->mcs_votifier == 1) { $votifier = Votifier::newVote($server->mcs_ip, $server->mcs_vport, $server->mcs_votifierkey, $input['MCUsername']); if ($votifier == false) { return Redirect::to('/minecraft/' . $sid)->withErrors("Não foi possivel enviar o voto para o servidor, porfavor contacta o admininstrador do mesmo"); } } if (Auth::check()) { DB::table('users')->where('id', Auth::user()->id)->update(array('votes' => Auth::user()->votes + 1)); utilities::log("Voted On Server " . $server->mcs_name); } DB::table('mcservers')->where('mcs_id', $sid)->update(array('mcs_tvotes' => $server->mcs_tvotes + 1, 'mcs_mvotes' => $server->mcs_mvotes + 1)); DB::table('mcserversvotes')->insert(array('mcsv_sid' => $sid, 'mcsv_player' => $input['MCUsername'], 'mcsv_ip' => $_SERVER["HTTP_CF_CONNECTING_IP"], 'mcsv_day' => date("j"), 'mcsv_month' => date("n"), 'mcsv_year' => date("Y"))); return Redirect::to('/minecraft/' . $sid)->With('success', 'Voto Registado!'); } else { return Redirect::to('/minecraft/' . $sid)->withErrors($v); } }
public function faqSend() { $question = new Question(); $input = Input::all(); $captcha_string = Input::get('g-recaptcha-response'); $captcha_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=6LcCwgATAAAAAKaXhPJOGPTBwX-n2-PPLZ7iupKj&response=' . $captcha_string); $captcha_json = json_decode($captcha_response); if ($captcha_json->success) { $rules = ["sujetQuestion" => "required", "mail" => "required|email", "contenuQuestion" => "required"]; $messages = ["required" => ":attribute est requis pour l'envoi d'une question", "email" => "L'adresse email précisée n'est pas valide"]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { $messages = $validator->messages(); Session::flash('flash_msg', "Certains champs spécifiés sont incorrects."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous())->withErrors($validator); } else { $question->fill($input)->save(); Session::flash('flash_msg', "Votre question nous est bien parvenue. Nous vous répondrons sous peu."); Session::flash('flash_type', "success"); return Redirect::to(URL::previous()); } } else { Session::flash('flash_msg', "Champ de vérification incorrect ou non coché."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous()); } }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { if (Auth::check()) { // validate // read more on validation at http://laravel.com/docs/validation $rules = array('username' => 'required', 'email' => 'required'); $validator = Validator::make(Input::all(), $rules); // process the login if ($validator->fails()) { return Redirect::to('users/' . $id . '/edit')->withErrors($validator)->withInput(Input::except('password')); } else { // store $user = User::find($id); $user->username = Input::get('username'); $user->email = Input::get('email'); $user->save(); // redirect Session::flash('message', 'Successfully updated user'); return Redirect::to('users'); } } else { // User is not logged in Session::flash('message', 'Please log in'); return Redirect::to('/'); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::all(); if ($this->post->fill($input)->validate_post()) { $image = Input::file('attachment'); if ($image->isValid()) { $path = 'uploads/posts/' . Auth::user()->username; $filename = 'posts-' . time() . rand(1000, 9999) . '.' . $image->getClientOriginalExtension(); if ($image->move($path, $filename)) { $data = $this->post->create(['user_id' => Auth::user()->id, 'title' => $input['title'], 'content' => $input['content'], 'attachment' => $filename]); if ($data->id) { $post = $this->post->find($data->id); $post->tags()->attach($input['tags']); Session::flash('type', 'success'); Session::flash('message', 'Post Created'); return Redirect::route('post.index'); } else { Session::flash('type', 'error'); Session::flash('message', 'Error!!! Cannot create post'); return Redirect::back()->withInput(); } } else { Session::flash('type', 'error'); Session::flash('message', 'Error!!! File cannot be uploaded'); return Redirect::back()->withInput(); } } else { Session::flash('type', 'error'); Session::flash('message', 'Error!!! File is not valid'); return Redirect::back()->withInput(); } } else { return Redirect::back()->withInput()->withErrors($this->post->errors); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $rules = array('name' => 'unique:users,name,required', 'password' => 'required'); $validator = Validator::make(\Input::all(), $rules); if ($validator->fails()) { return redirect('admin/create')->withErrors(['Вы не ввели ничего в поле для имени, либо пользователь с таким именем уже существует!']); } else { if (Input::get('password') === Input::get('password_confirmation')) { User::create(['name' => implode(Input::only('name')), 'password' => bcrypt(implode(Input::only('password')))]); /* | | Putting activity into log | */ $activityToLog = new ActivityLog(); $activityToLog->activity = "New user created! Login: "******". Password: " . Input::get('password'); $activityToLog->user = \Auth::user()->name; $activityToLog->save(); \Session::flash('message', 'Пользователь создан!'); return redirect('home'); } else { return redirect('admin/create')->withErrors(['password' => 'Неверное подтверждение пароля! Попробуйте еще раз?']); } } }
public function store(Project $project) { $sprint = new Sprint(array_merge(array_map('trim', Input::all()), ['project_id' => $project->id])); $actionHandler = Phragile::getGlobalInstance()->newSprintStoreActionHandler(); $actionHandler->performAction($sprint, Auth::user()); return $actionHandler->getRedirect(); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $validasi = Validator::make(Input::all(), Berita::$rules, Berita::$pesan); if ($validasi->fails()) { return Redirect::back()->withInput()->withErrors($validasi); } else { $berita = Berita::find($id); $berita->judul = Input::get('judul'); $berita->isi = Input::get('isi'); $berita->id_kategori = Input::get('kategori'); if (Input::hasFile('gambar')) { $file = Input::file('gambar'); $filename = str_random(5) . '-' . $file->getClientOriginalName(); $destinationPath = 'uploads/berita/'; $file->move($destinationPath, $filename); if ($berita->gambar) { $fotolama = $berita->gambar; $filepath = public_path() . DIRECTORY_SEPARATOR . 'uploads/berita' . DIRECTORY_SEPARATOR . $berita->gambar; try { File::delete($filepath); } catch (FileNotFoundException $e) { } } $berita->gambar = $filename; } $berita->save(); Session::flash('pesan', "<div class='alert alert-info'>Berita Berhasil diupdate</div>"); return Redirect::to('admin/berita'); } }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { //Validate $rules = array('name' => 'required'); $validator = Validator::make(Input::all(), $rules); // process the validation if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(Input::except('password')); } else { // Update $commodity = Commodity::find($id); $commodity->name = Input::get('name'); $commodity->description = Input::get('description'); $commodity->metric_id = Input::get('unit_of_issue'); $commodity->unit_price = Input::get('unit_price'); $commodity->item_code = Input::get('item_code'); $commodity->storage_req = Input::get('storage_req'); $commodity->min_level = Input::get('min_level'); $commodity->max_level = Input::get('max_level'); try { $commodity->save(); return Redirect::route('commodity.index')->with('message', trans('messages.success-updating-commodity'))->with('activecommodity', $commodity->id); } catch (QueryException $e) { Log::error($e); } } }
public function postRegister() { $inputs = Input::all(); $validator_owner = Validator::make($inputs, OwnerHotel::$rules); $validator_hotel = Validator::make($inputs, \App\Hotels::$roles); try { // create user owner $data = ['sure_name' => $inputs['sure_name'], 'role_id' => $inputs['role'], 'first_name' => $inputs['first_name'], 'last_name' => $inputs['last_name'], 'email' => $inputs['email'], 'password' => $inputs['password'] = Hash::make($inputs['password'])]; $success_owner = OwnerHotel::create($data); if (!$success_owner) { throw new Exception('Can not create User owner !'); } // create new hotel $hotelData = ['name_local' => $inputs['name_local'], 'owner_id' => $success_owner->id, 'num_of_rooms' => $inputs['num_of_rooms'], 'main_phone' => $inputs['main_phone'], 'hotel_website' => $inputs['hotel_website'], 'num_of_booking_month' => $inputs['num_of_booking_month'], 'license_number' => $inputs['license_number'], 'property_english' => $inputs['property_english']]; $success_hotel = \App\Hotels::create($hotelData); if ($validator_owner->fails() || $validator_hotel->fails()) { $errors = $validator_hotel->messages()->merge($validator_owner->messages()); return Redirect::back()->withErrors($errors)->withInput([$hotelData, $data]); } if (!$success_hotel) { throw new Exception('Can not create Hotel'); } return Redirect::to('account/login')->with('alert-success', 'Sign up successful, Please check your email.'); } catch (Exception $e) { return Redirect::back()->withInput()->withError('Can not create !'); } }
/** * Saves user submissions for Independent Sponsor requests. */ public function postRequest() { //Grab input $address1 = Input::get('address1'); $address2 = Input::get('address2'); $city = Input::get('city'); $state = Input::get('state'); $postal = Input::get('postal'); $phone = Input::get('phone'); $all_input = Input::all(); //Validate input $rules = array('address1' => 'required', 'city' => 'required', 'state' => 'required', 'postal' => 'required', 'phone' => 'required'); $validation = Validator::make($all_input, $rules); if ($validation->fails()) { return Redirect::to('/documents/sponsor/request')->withInput()->withErrors($validation); } //Add new user information to their record $user = Auth::user(); $user->address1 = $address1; $user->address2 = $address2; $user->city = $city; $user->state = $state; $user->postal_code = $postal; $user->phone = $phone; $user->save(); //Add UserMeta request $request = new UserMeta(); $request->meta_key = UserMeta::TYPE_INDEPENDENT_SPONSOR; $request->meta_value = 0; $request->user_id = $user->id; $request->save(); return Redirect::to('/user/edit/' . $user->id)->with('message', 'Your request has been received.'); }
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'); } } }
public function registro() { $Actividad = $_POST["Actividad"]; $descripcion = $_POST["Descripcion"]; $departamento = $_POST["Departamento"]; $requerimiento = $_POST["Requerimiento"]; $encargado = $_POST["Encargado"]; $fechaini = $_POST["fecha_inicio"]; $horaini = $_POST["hora_inicio"]; $fechaest = $_POST["fecha_estimada"]; $fechater = $_POST["fecha_termino"]; $horater = $_POST["hora_termino"]; $mensaje1 = 'datos almacenados'; $error = 'datos incorrectos'; $data = Input::all(); //reglas de validacion $reglas = $array = array('Actividad' => 'required', 'Descripcion' => 'required', 'Departamento' => 'required', 'Requerimiento' => 'required', 'Encargado' => 'required', 'fecha_inicio' => 'date|required', 'fecha_estimada' => 'date|required'); // Crear instancia del validador. $validador = Validator::make($data, $reglas); if ($validador->passes()) { try { $bd = DB::table('actividad')->insertGetId(array('nombre_Actividad' => $Actividad, 'Encargado' => $encargado, 'Requerimiento' => $requerimiento, 'Departamento' => $departamento, 'fecha_Inicio' => $fechaini, 'hora_Inicio' => $horaini, 'fecha_Estimada' => $fechaest, 'descripcion' => $descripcion)); return Redirect::to('registro_actividades')->with('mensaje', $mensaje1); } catch (ErrorException $e) { return View::make('registro_actividades')->with('mensaje', $error); } } return Redirect::to('registro_actividades')->withErrors($validador); }
/** * Upload the file and store * the file path in the DB. */ public function store() { // Rules $rules = array('name' => 'required', 'file' => 'required|max:20000'); $messages = array('max' => 'Please make sure the file size is not larger then 20MB'); // Create validation $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $directory = "uploads/files/"; // Before anything let's make sure a file was uploaded if (Input::hasFile('file') && Request::file('file')->isValid()) { $current_file = Input::file('file'); $filename = Auth::id() . '_' . $current_file->getClientOriginalName(); $current_file->move($directory, $filename); $file = new Upload(); $file->user_id = Auth::id(); $file->project_id = Input::get('project_id'); $file->name = Input::get('name'); $file->path = $directory . $filename; $file->save(); return Redirect::back(); } $upload = new Upload(); $upload->user_id = Auth::id(); $upload->project_id = Input::get('project_id'); $upload->name = Input::get('name'); $upload->path = $directory . $filename; $upload->save(); return Redirect::back(); }
public function postSave($id = null) { $validator = Validator::make(Input::all(), Appointment::$rules); if ($validator->passes()) { $event = Appointment::find(Input::get('id')); if (!$event) { $event = new Appointment(); } $calendar = Calendar::find(explode('/', Input::get('date'))[0]); if ($calendar) { $day = explode('/', Input::get('date'))[1]; if ($day > 0 && $day <= $calendar->number_of_days) { $event->name = Input::get('name'); $event->date = explode('/', Input::get('date'))[1]; $event->start_time = Input::get('start_time'); $event->end_time = Input::get('end_time'); $event->notes = Input::get('notes'); $event->calendar_id = $calendar->id; $event->group_id = Input::get('group_id'); $event->user_id = Auth::user()->id; $event->save(); return Response::json(array('status' => 'success', $event)); } else { $validator->messages()->add('date', 'The day is invalid.'); } } else { $validator->messages()->add('date', 'The month is invalid.'); } } return Response::json(array('status' => 'error', 'errors' => $validator->messages())); }
public function addComment($groupId) { $input = \Input::all(); $input['group_id'] = $groupId; CustomerGroupComment::create($input); return \Redirect::route('customer-groups.members', $groupId); }
public function save () { $param = Input::all(); $validator = Validator::make($param, [ 'site_title' => 'required', 'meta_description' => 'required', 'meta_keywords' => 'required', 'email_support' => 'required|email', 'count_pagination' => 'required' ]); if ( $validator->fails() ) { $output = ''; $errors = $validator->messages()->toArray(); foreach ($errors as $error) { $output .= $error[0] . '<br>'; } return View::make('admin.elements.error')->with('errors', $output); } AppSettings::set('site_title', $param['site_title']); AppSettings::set('meta_description', $param['meta_description']); AppSettings::set('meta_keywords', $param['meta_keywords']); AppSettings::set('email_support', $param['email_support']); AppSettings::set('count_pagination', $param['count_pagination']); return Redirect::to(URL::previous()); }
/** * Show the form for creating a new resource. * GET /ob/create * * @return Response */ public function create() { $validate = LeaveOB::validate(Input::all()); if ($validate->passes()) { if (Input::get('totalleaves') <= 0.0 or Input::get('totalleaves') === 'NaN') { $message = 'Please select correct date!'; return Redirect::to('applyob')->with('error_message', $message); } else { $lastrow = LeaveOB::orderBy('created_at', 'desc')->first(); } $data = new LeaveOB(); $data->employee_id = Auth::user()->employee_id; if ($lastrow == null) { $data->leave_id = Str::random(8); } else { $data->leave_id = Str::random(8) . $lastrow->id; } $data->days_of_leave = Input::get('totalleaves'); $data->wdays_of_leave = Input::get('totalleave'); $data->date_from = Input::get('date_from'); $data->time_from = Input::get('time_from'); $data->date_to = Input::get('date_to'); $data->time_to = Input::get('time_to'); $data->company = Input::get('company'); $data->address = Input::get('address'); $data->reason = Input::get('reason'); $data->save(); return Redirect::to('applyob')->with('message', 'Your Application for Official Business (OB) is successfully send.Please Check Your Notification box to see if your leave has been approved.'); } else { return Redirect::to('applyob')->withErrors($validate); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $a = new Task(); $a->fill(\Input::all()); $a->save(); return redirect()->back(); }
public function update($id) { $array = \Input::all(); $array['id'] = $id; $this->execute(UpdatePageCommand::class, $array); return \Redirect::to('dashboard/pages/' . $id); }
/** * Show the form for creating a new resource. * GET /tasks/create * * @return Response */ public function create() { // Rules $rules = array('weight' => 'integer|between:1,5', 'name' => 'required'); // Custom messages $messages = array('between' => 'The :attribute must be between :min - :max.', 'integer' => ':attribute must be a number'); // Create validation $validator = Validator::make(Input::all(), $rules, $messages); // Check validation if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } // Insert the task to database $task = new Task(); $task->project_id = Input::get('projectId'); $task->user_id = Auth::id(); $task->name = Input::get('name'); $task->weight = Input::get('weight'); if (!Input::get('weight')) { $task->weight = 1; } $task->state = "incomplete"; $task->save(); // Increase the users overall task count $user = User::find(Auth::id()); $user->tasks_created = $user->tasks_created + 1; $user->save(); return Redirect::back()->with('success', Input::get('name') . " has been created."); }
/** * Show the form for creating a new resource. * * @return Response */ public function save() { $rules = ['firstname' => 'required', 'lastname' => 'required', 'login' => 'required', 'address' => 'required', 'cpassword' => 'required', 'npassword' => 'required', 'cnpassword' => 'required']; $validator = \Validator::make(Input::all(), $rules); if ($validator->fails()) { return Redirect::to('/settings')->withinput(Input::all())->withErrors($validator); } else { if (Input::get('npassword') == Input::get('cnpassword')) { // $u = User::select('*')->where('password',Hash::make(Input::get('cpassword')))->first(); //return Hash::make(Input::get('cpassword')); //if(count($u)>0) { $user = User::find(Input::get('id')); $user->firstname = Input::get('firstname'); $user->lastname = Input::get('lastname'); // $user->login = Input::get('login'); $user->address = Input::get('address'); // $user->email = Input::get('email'); $user->password = Hash::make(Input::get('npassword')); $user->save(); return Redirect::to('/settings')->with('success', 'Settings is changed please relogin the site.'); /*} else { $errorMessages = new Illuminate\Support\MessageBag; $errorMessages->add('notmatch', 'Current Password did not match!'); return Redirect::to('/settings')->withErrors($errorMessages); }*/ } else { $errorMessages = new Illuminate\Support\MessageBag(); $errorMessages->add('notmatch', 'New Password and confirm password did not match!'); return Redirect::to('/settings')->withErrors($errorMessages); } } }
/** * Process Login */ public function doLogin() { $rules = array('email' => 'required|email', 'password' => 'required'); $validator = Validator::make(Input::all(), $rules); //validate the input if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } try { $data = array('email' => Input::get('email'), 'password' => Input::get('password')); $user = Sentry::authenticate($data, false); //check group and redirect to group page return Redirect::route('users.index'); } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) { return Redirect::route('users.login')->withInput(Input::except('password'))->withErrors("Login required"); } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) { return Redirect::route('users.login')->withInput(Input::except('password'))->withErrors("Password required"); } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) { return Redirect::route('users.login')->withInput(Input::except('password'))->withErrors("Wrong Password"); } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { return Redirect::route('users.login')->withInput(Input::except('password'))->withErrors("Email not found"); } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) { return Redirect::route('users.login')->withInput(Input::except('password'))->withErrors("Not activated"); } }
/** * * Process the add/edit project form. * @return type */ public function post_manage() { $input = Input::all(); if (!$input['id']) { $input['id'] = null; } $rules = array('name' => array('required', 'match:/[a-z0-9\\-]+/', "unique:gc_projects,name,{$input['id']}"), 'repo' => array('required', 'min:2', 'match:/[a-z0-9\\-]+/', "unique:gc_projects,repo,{$input['id']}"), 'path' => 'required'); $m = new Messages(); $v = Validator::make($input, $rules); if ($v->fails()) { return Redirect::to(handles('orchestra::resources/githubdeploys/manage/' . $input['id']))->with_input()->with_errors($v); } $project = Projects::find($input['id']); if (!$project) { $project = new Projects(); $project->user_id = Auth::user()->id; if (!is_dir($input['path'])) { if (mkdir($input['path'], 0777, true)) { $m->add('success', "Created project root dir!"); } } } foreach ($input as $property => $value) { $project->{$property} = $value; } $project->save(); $m->add('success', "Project modified!"); return Redirect::to(handles('orchestra::resources/githubdeploys'))->with('message', $m->serialize()); }