/** * Handle a registration request for the application. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function postRegister(Request $request) { $me = $request->all(); $validator = $this->registrar->validator($request->all()); $confirmation_code = str_random(30); if ($validator->fails()) { //dd($validator); $this->throwValidationException($request, $validator); } // $this->auth->login($this->registrar->create($me)); $user = User::find(Input::get('email')); if ($user) { $this->auth->login($this->registrar->create($me)); } $confirm = new Confirm(); $confirm->name = Input::get('name'); $confirm->email = Input::get('email'); $confirm->password = Hash::make(Input::get('password')); $confirm->confirmation_code = $confirmation_code; $confirm->save(); if (Mail::send('emailverify', array('confirmation_code' => $confirmation_code, 'username' => Input::get("name")), function ($message) { $message->to(Input::get('email'), Input::get('username'))->subject('Verify your email address'); })) { return view('doverification')->with(["message" => 'please verify the email address (' . Input::get("email") . ') through verification code we sent to you on the registerd email-address!!!<br> plz also check you sapn folder', 'button_message' => 'Verify', 'button_url' => 'http://www' . Input::get("email") . '/']); } return "error"; }
public function confirm($confirmation_code) { if (!$confirmation_code) { return $confirmation_code; } $user = Confirm::whereConfirmationCode($confirmation_code)->first(); if (!$user) { return view("doverification")->with(["message" => "your token is expired that means either you are already register or you token gets expired!!!", 'button_message' => 'Register', 'button_url' => "/auth/Register/"]); } $newuser = new User(); $newuser->email = $user->email; $newuser->name = $user->name; $newuser->password = $user->password; $newuser->save(); //for login $newuser = User::find($user->email); Auth::login($newuser); $user->delete(); // $user->confirmed = 1; // $user->confirmation_code = null; // $user->save(); return Redirect::to('profile_settings'); }