| @@ 175-180 (lines=6) @@ | ||
| 172 | $this->loadModel('User.Users'); |
|
| 173 | $user = $this->Users->get($id, ['fields' => ['id', 'name', 'email']]); |
|
| 174 | ||
| 175 | if ($this->Users->updateAll(['status' => 1], ['id' => $user->id])) { |
|
| 176 | NotificationManager::activated($user)->send(); |
|
| 177 | $this->Flash->success(__d('user', 'User {0} was successfully activated!', $user->name)); |
|
| 178 | } else { |
|
| 179 | $this->Flash->danger(__d('user', 'User could not be activated, please try again.')); |
|
| 180 | } |
|
| 181 | ||
| 182 | $this->title(__d('user', 'Unblock User Account')); |
|
| 183 | $this->redirect($this->referer()); |
|
| @@ 147-153 (lines=7) @@ | ||
| 144 | $user->accessible(['id', 'token', 'status', 'last_login', 'created', 'roles'], false); |
|
| 145 | $user = $this->Users->patchEntity($user, $this->request->data); |
|
| 146 | ||
| 147 | if ($this->Users->save($user)) { |
|
| 148 | NotificationManager::welcome($user)->send(); |
|
| 149 | $this->Flash->success(__d('user', 'Account successfully created, further instructions have been sent to your e-mail address.', ['key' => 'register'])); |
|
| 150 | $registered = true; |
|
| 151 | } else { |
|
| 152 | $this->Flash->danger(__d('user', 'Account could not be created, please check your information.'), ['key' => 'register']); |
|
| 153 | } |
|
| 154 | } |
|
| 155 | ||
| 156 | $this->title(__d('user', 'Registration')); |
|
| @@ 183-189 (lines=7) @@ | ||
| 180 | ->limit(1) |
|
| 181 | ->first(); |
|
| 182 | ||
| 183 | if ($user) { |
|
| 184 | NotificationManager::welcome($user)->send(); |
|
| 185 | $this->Flash->success(__d('user', 'Instructions have been sent to your e-mail address.'), ['key' => 'activation_email']); |
|
| 186 | $sent = true; |
|
| 187 | } else { |
|
| 188 | $this->Flash->danger(__d('user', 'No account was found matching the given username/email.'), ['key' => 'activation_email']); |
|
| 189 | } |
|
| 190 | } |
|
| 191 | ||
| 192 | $this->title(__d('user', 'Activation Request')); |
|