リビジョン 304d523f app/Controller/UsersController.php
app/Controller/UsersController.php | ||
---|---|---|
117 | 117 |
public function activate( $user_id = null, $in_hash = null) { |
118 | 118 |
// UserモデルにIDをセット |
119 | 119 |
$this->User->id = $user_id; |
120 |
$mail = $this->Session->read('register.User.email'); |
|
121 |
|
|
122 |
$options = array('conditions' => array('User.email' => $mail, 'User.status' => 1)); |
|
123 |
$user = $this->User->find('count', $options); |
|
124 |
if($user > 0){ |
|
125 |
// 本登録に無効なURL |
|
126 |
$this->Session->setFlash( 'このメールアドレスは登録済みです'); |
|
127 |
return $this->redirect(array('controller' => 'top', 'action' => 'error')); |
|
128 |
} |
|
120 | 129 |
if ($this->User->exists() && $in_hash == $this->User->activationHash()) { |
121 | 130 |
// 本登録に有効なURL |
122 | 131 |
// statusフィールドを1に更新 |
123 | 132 |
$this->User->saveField( 'status', 1); |
124 | 133 |
$this->Session->setFlash( 'Your account has been activated.'); |
125 | 134 |
|
126 |
$mail = $this->Session->read('register.User.email'); |
|
127 | 135 |
// exit; |
128 | 136 |
|
129 | 137 |
$Email = new CakeEmail(); |
... | ... | |
215 | 223 |
* @return void |
216 | 224 |
*/ |
217 | 225 |
public function login() { |
218 |
if($this->Auth->user()){
|
|
226 |
if($this->Auth->user('status') == 1){
|
|
219 | 227 |
$this->redirect('/users/login_top'); |
220 | 228 |
} |
221 | 229 |
if ($this->request->is('post')) { |
... | ... | |
264 | 272 |
if($this->User->validates()){ |
265 | 273 |
$this->Session->write('register',$this->request->data); |
266 | 274 |
$this->redirect(array('action'=>'reset_pwd_confirm')); |
267 |
}else{ |
|
268 |
$this->Flash->loginerror('メールアドレスが一致しません。誤りがないかもう一度ご確認の上、正確にご入力ください。', array( |
|
269 |
'key' => 'positive', |
|
270 |
)); |
|
275 |
// }else{
|
|
276 |
// $this->Flash->loginerror('メールアドレスが一致しません。誤りがないかもう一度ご確認の上、正確にご入力ください。', array(
|
|
277 |
// 'key' => 'positive',
|
|
278 |
// ));
|
|
271 | 279 |
} |
272 | 280 |
} |
273 | 281 |
} |
他の形式にエクスポート: Unified diff