CI = & get_instance(); $this->CI->load->library(array('email')); } function main() { $this->CI->load->model('Apps_model'); if ( ! $this->CI->input->post_get('token')) { $this->CI->apilib->make_error("토큰 값이 넘어오지 않았습니다"); } $token = $this->CI->input->post_get('token'); $app_id = (int) trim($this->CI->input->post_get('app_id')); if (empty($app_id)) { $this->CI->apilib->make_error("어플 아이디가 넘어오지 않았습니다"); } $email = trim($this->CI->input->post('email')); if ( ! $email) { $this->CI->apilib->make_error("이메일이 입력되지 않았습니다"); } $this->CI->load->helper('string'); if ( ! function_exists('password_hash')) { $this->CI->load->helper('password'); } $userinfo = $this->CI->User_model->get_by_api_email($app_id, $email, 'user_id, user_email, user_denied, user_username, user_password'); if (element('user_denied', $userinfo)) { $this->CI->apilib->make_error("회원님의 아이디는 접근이 금지된 아이디입니다"); } if ( ! element('user_id', $userinfo)) { $this->CI->apilib->make_error("일치하는 회원정보가 없습니다"); } $user_id = element('user_id', $userinfo); $new_password = rand(100000,999999); $hash = password_hash($new_password, PASSWORD_BCRYPT); $updatedata = array( 'user_password' => $hash, ); $upwhere = array( 'app_id' => $app_id, 'user_id' => $user_id, ); $this->CI->User_model->update('', $updatedata, $upwhere); $appinfo = $this->CI->Apps_model->get_one($app_id); $email_title = '[' . element('app_name', $appinfo) . '] 회원님의 패스워드가 변경되었습니다.'; $email_content = '
| ' . element('app_name', $appinfo) . ' | 안녕하세요 ' . html_escape(element('user_username', $userinfo)) . '님, 회원님의 패스워드 변경 |
' . html_escape(element('user_username', $userinfo)) . '님, 안녕하세요!
회원님의 패스워드가 변경되었습니다. 변경된 패스워드는 다음과 같습니다 ' . $new_password . '
감사합니다. | |