Changeset 2566:9bf417837888 for admin/auth.php
- Timestamp:
- 11/17/13 20:25:53 (12 years ago)
- Branch:
- 2.6
- Children:
- 2567:6c11245cbf04, 2568:61c67a7d17fa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/auth.php
r2311 r2566 83 83 { 84 84 $recover_key = $core->auth->setRecoverKey($user_id,$user_email); 85 85 86 86 $subject = mail::B64Header('DotClear '.__('Password reset')); 87 87 $message = … … 90 90 __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.')."\n". 91 91 $page_url.'?akey='.$recover_key; 92 92 93 93 $headers[] = 'From: '.(defined('DC_ADMIN_MAILFROM') && DC_ADMIN_MAILFROM ? DC_ADMIN_MAILFROM : 'dotclear@local'); 94 94 $headers[] = 'Content-Type: text/plain; charset=UTF-8;'; 95 95 96 96 mail::sendMail($user_email,$subject,$message,$headers); 97 97 $msg = sprintf(__('The e-mail was sent successfully to %s.'),$user_email); … … 108 108 { 109 109 $recover_res = $core->auth->recoverUserPassword($akey); 110 110 111 111 $subject = mb_encode_mimeheader('DotClear '.__('Your new password'),'UTF-8','B'); 112 112 $message = … … 114 114 __('Password:').' '.$recover_res['new_pass']."\n\n". 115 115 preg_replace('/\?(.*)$/','',$page_url); 116 116 117 117 $headers[] = 'From: dotclear@'.$_SERVER['HTTP_HOST']; 118 118 $headers[] = 'Content-Type: text/plain; charset=UTF-8;'; 119 119 120 120 mail::sendMail($recover_res['user_email'],$subject,$message,$headers); 121 121 $msg = __('Your new password is in your mailbox.'); … … 143 143 throw new Exception(); 144 144 } 145 145 146 146 # Check login informations 147 147 $check_user = false; … … 157 157 } 158 158 } 159 159 160 160 if (!$core->auth->allowPassChange() || !$check_user) { 161 161 $change_pwd = false; 162 162 throw new Exception(); 163 163 } 164 164 165 165 if ($_POST['new_pwd'] != $_POST['new_pwd_c']) { 166 166 throw new Exception(__("Passwords don't match")); 167 167 } 168 168 169 169 if ($core->auth->checkUser($user_id,$_POST['new_pwd']) === true) { 170 170 throw new Exception(__("You didn't change your password.")); 171 171 } 172 172 173 173 $cur = $core->con->openCursor($core->prefix.'user'); 174 174 $cur->user_change_pwd = 0; 175 175 $cur->user_pwd = $_POST['new_pwd']; 176 176 $core->updUser($core->auth->userID(),$cur); 177 177 178 178 $core->session->start(); 179 179 $_SESSION['sess_user_id'] = $user_id; 180 180 $_SESSION['sess_browser_uid'] = http::browserUID(DC_MASTER_KEY); 181 181 182 182 if ($data['user_remember']) 183 183 { 184 184 setcookie('dc_admin',$data['cookie_admin'],strtotime('+15 days'),'','',DC_ADMIN_SSL); 185 185 } 186 186 187 187 http::redirect('index.php'); 188 188 } … … 202 202 $check_perms = false; 203 203 } 204 204 205 205 $cookie_admin = http::browserUID(DC_MASTER_KEY.$user_id. 206 206 crypt::hmac(DC_MASTER_KEY,$user_pwd)).bin2hex(pack('a32',$user_id)); 207 207 208 208 if ($check_perms && $core->auth->mustChangePassword()) 209 209 { … … 213 213 empty($_POST['user_remember'])?'0':'1' 214 214 )); 215 215 216 216 if (!$core->auth->allowPassChange()) { 217 217 $err = __('You have to change your password before you can login.'); … … 221 221 } 222 222 } 223 elseif ($check_perms && !empty($_POST['safe_mode']) && !$core->auth->isSuperAdmin()) 223 elseif ($check_perms && !empty($_POST['safe_mode']) && !$core->auth->isSuperAdmin()) 224 224 { 225 225 $err = __('Safe Mode can only be used for super administrators.'); … … 230 230 $_SESSION['sess_user_id'] = $user_id; 231 231 $_SESSION['sess_browser_uid'] = http::browserUID(DC_MASTER_KEY); 232 232 233 233 if (!empty($_POST['blog'])) { 234 234 $_SESSION['sess_blog_id'] = $_POST['blog']; 235 235 } 236 236 237 237 if (!empty($_POST['safe_mode']) && $core->auth->isSuperAdmin()) { 238 238 $_SESSION['sess_safe_mode'] = true; 239 239 } 240 240 241 241 if (!empty($_POST['user_remember'])) { 242 242 setcookie('dc_admin',$cookie_admin,strtotime('+15 days'),'','',DC_ADMIN_SSL); 243 243 } 244 244 245 245 http::redirect('index.php'); 246 246 } … … 280 280 <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> 281 281 282 282 283 283 <?php 284 284 echo dcPage::jsLoadIE7(); 285 285 echo dcPage::jsCommon(); 286 286 ?> 287 287 288 288 <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" /> 289 289 290 290 <?php 291 291 # --BEHAVIOR-- loginPageHTMLHead 292 292 $core->callBehavior('loginPageHTMLHead'); 293 293 ?> 294 294 295 295 <script type="text/javascript"> 296 296 //<![CDATA[ … … 299 299 var upw = $('input[name=user_pwd]'); 300 300 uid.focus(); 301 301 302 302 if (upw.length == 0) { return; } 303 303 304 304 uid.keypress(processKey); 305 305 … … 347 347 '<p><label for="user_id">'.__('Username:').'</label> '. 348 348 form::field(array('user_id','user_id'),20,32,html::escapeHTML($user_id)).'</p>'. 349 349 350 350 '<p><label for="user_email">'.__('Email:').'</label> '. 351 351 form::field(array('user_email','user_email'),20,255,html::escapeHTML($user_email)).'</p>'. 352 352 353 353 '<p><input type="submit" value="'.__('recover').'" />'. 354 354 form::hidden(array('recover'),1).'</p>'. 355 355 '</div>'. 356 356 357 357 '<div id="issue">'. 358 358 '<p><a href="auth.php">'.__('Back to login screen').'</a></p>'. … … 365 365 '<p><label for="new_pwd">'.__('New password:').'</label> '. 366 366 form::password(array('new_pwd','new_pwd'),20,255).'</p>'. 367 367 368 368 '<p><label for="new_pwd_c">'.__('Confirm password:').'</label> '. 369 369 form::password(array('new_pwd_c','new_pwd_c'),20,255).'</p>'. 370 370 '</div>'. 371 371 372 372 '<p><input type="submit" value="'.__('change').'" />'. 373 373 form::hidden('login_data',$login_data).'</p>'; … … 384 384 echo '<div class="fieldset">'; 385 385 echo '<h2>'.__('Safe mode login').'</h2>'; 386 echo 386 echo 387 387 '<p class="form-note">'. 388 388 __('This mode allows you to login without activating any of your plugins. This may be useful to solve compatibility problems').' </p>'. … … 397 397 '<p><label for="user_id">'.__('Username:').'</label> '. 398 398 form::field(array('user_id','user_id'),20,32,html::escapeHTML($user_id)).'</p>'. 399 399 400 400 '<p><label for="user_pwd">'.__('Password:').'</label> '. 401 401 form::password(array('user_pwd','user_pwd'),20,255).'</p>'. 402 402 403 403 '<p>'. 404 404 form::checkbox(array('user_remember','user_remember'),1). 405 405 '<label for="user_remember" class="classic">'. 406 406 __('Remember my ID on this computer').'</label></p>'. 407 407 408 408 '<p><input type="submit" value="'.__('log in').'" class="login" /></p>'; 409 409 410 410 if (!empty($_REQUEST['blog'])) { 411 411 echo form::hidden('blog',html::escapeHTML($_REQUEST['blog'])); 412 412 } 413 413 if($safe_mode) { 414 echo 414 echo 415 415 form::hidden('safe_mode',1). 416 416 '</div>'; … … 423 423 424 424 echo '<div id="issue">'; 425 425 426 426 if ($safe_mode) { 427 427 echo … … 434 434 echo '<p><a href="auth.php?safe_mode=1" id="safe_mode_link">'.__('I want to log in in safe mode').'</a></p>'; 435 435 } 436 436 437 437 echo '</div>'; 438 438 }
Note: See TracChangeset
for help on using the changeset viewer.