Skip to content

Commit

Permalink
Merge pull request #28 from GrupaZero/KMS-225_add_user_nickname_field
Browse files Browse the repository at this point in the history
Add user nickName field
  • Loading branch information
PSkierniewski committed Apr 9, 2016
2 parents e43b4c5 + 80d42e0 commit 328c243
Show file tree
Hide file tree
Showing 30 changed files with 476 additions and 214 deletions.
1 change: 1 addition & 0 deletions .env.example
Expand Up @@ -37,3 +37,4 @@ VANILLA_FORUM_SECRET=
DISQUS_API_KEY=
DISQUS_API_SECRET=
DISQUS_DOMAIN=
DISQUS_ENABLED=false
3 changes: 2 additions & 1 deletion app/Http/Controllers/AccountApiController.php
Expand Up @@ -52,8 +52,9 @@ public function update($id)
if (!Input::has('password')) {
$this->validator->setData(Input::except(['password', 'password_confirmation']));
}
$input = $this->validator->validate('update');
$user = $this->userRepo->getById($id);
$input = $this->validator->bind('nickName', ['userId' => $user->id])->bind('email', ['userId' => $user->id])
->validate('update');
$this->userRepo->update($user, $input);
return Response::json(['success' => true]);
} catch (ValidationException $e) {
Expand Down
53 changes: 19 additions & 34 deletions app/Http/Controllers/UserController.php
Expand Up @@ -100,42 +100,27 @@ public function postRegister()
}

try {
$input = $this->validator->validate('register');
$existingUser = $this->userRepo->getByEmail($input['email']);
// duplicated user verification
if ($existingUser === null) {
$input['password'] = Hash::make($input['password']);
$user = $this->userRepo->create($input);
if (!empty($user)) {
Auth::login($user);
try {
$subject = Lang::get('emails.welcome.subject', ['siteName' => Config::get('gzero.siteName')]);
Mail::send( // welcome email
'emails.auth.welcome',
['user' => $user],
function ($message) use ($input, $subject) {
$message->subject($subject)
->to($input['email'], $input['firstName'] . ' ' . $input['lastName']);
}
);
} catch (\Swift_TransportException $e) {
/**@TODO Better way to handle exceptions on production */
Log::error('Unable to send welcome email: ' . $e->getMessage());
}
$input = $this->validator->validate('register');
$input['password'] = Hash::make($input['password']);
$user = $this->userRepo->create($input);
if (!empty($user)) {
Auth::login($user);
try {
$subject = Lang::get('emails.welcome.subject', ['siteName' => Config::get('gzero.siteName')]);
Mail::send( // welcome email
'emails.auth.welcome',
['user' => $user],
function ($message) use ($input, $subject) {
$message->subject($subject)
->to($input['email'], $input['firstName'] . ' ' . $input['lastName']);
}
);
} catch (\Swift_TransportException $e) {
/**@TODO Better way to handle exceptions on production */
Log::error('Unable to send welcome email: ' . $e->getMessage());
}
return redirect()->intended('account');
} else {
Session::flash(
'messages',
[
[
'code' => 'error',
'text' => Lang::get('common.emailAlreadyInUseMessage')
]
]
);
return redirect()->route('register')->withInput();
}
return redirect()->intended('account');
} catch (ValidationException $e) {
return redirect()->route('register')->withInput()->withErrors($e->getErrors());
}
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/AppServiceProvider.php
Expand Up @@ -38,7 +38,7 @@ function ($view) {
if ($user) {
$data = [
"id" => $user["id"],
"username" => $user["firstName"] . ' ' . $user["lastName"],
"username" => $user->getPresenter()->displayName(),
"email" => $user["email"],
//"avatar" => $user["avatar"],
];
Expand Down
37 changes: 37 additions & 0 deletions changelog.md
@@ -1,4 +1,41 @@
###Changelog:
##v0.0.6
*GZERO PLATFORM*

- Added user nickName field
- Added email field to edit user account form
- Added missing disquss counter
- Added handling social accounts without email field
- Fixed api url on edit account when multi language is disabled
- Fixed SEO fields formatting issues
- Fixed lang code in html tag
- Fixed loading mask dimensions

*GZERO ADMIN*

- Added user nickName field

*GZERO API*

- Added user nickName field

*GZERO CMS*

- Added user nickName field
- Added unique nickname for users with empty on user creation
- Fixed SEO fields in translation presenter

*GZERO SOCIAL*

- Added user email from social response for user creation
- Unique social id is now used as fallback for response with missing email
- Fixed social login buttons so that they are visible only for configured services
- Fixed loading mask

*GZERO VANILLA-INTEGRATION*

- Added user nickName field

##v0.0.5
*GZERO PLATFORM*

Expand Down

0 comments on commit 328c243

Please sign in to comment.