public function postClientSignUp(Request $request) { $rules = ['email' => 'required|email', 'password' => 'required|min:6|max:20', 'password2' => 'required|same:password']; $this->validate($request, $rules); $name = $request->get('name', ''); $email = $request->get('email'); $password = $request->get('password'); $localUser = UserMapper::getByEmail($email); if ($localUser && $localUser->type == 'client') { return Redirect::back()->withErrors(['email' => 'Client with this email already exists'])->withInput($request->all()); } if ($name == '') { $name = anonymizeEmail($email); } $data = ['name' => $name, 'email' => $email, 'password' => $password]; $localUser = $this->create($data); $localUser->is_active = 0; $localUser->role = 'user'; $localUser->type = 'client'; $localUser->save(); LogMapper::log('client_register', $localUser->id); NotificationMapper::registration($localUser); $this->sendClientWelcome($localUser, $password); $user = $localUser; return view('app.pages.user.client.auth.post_register', compact('user')); }
public function getNameAttribute($value) { return anonymizeEmail($value); }