67 lines
1.5 KiB
PHP
67 lines
1.5 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
/**
|
|
* Signup_check_email
|
|
*/
|
|
|
|
|
|
class Signup_check_email extends CI_Controller
|
|
{
|
|
|
|
private $CI;
|
|
|
|
function __construct()
|
|
{
|
|
$this->CI = & get_instance();
|
|
|
|
}
|
|
|
|
function main()
|
|
{
|
|
|
|
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("어플 아이디가 넘어오지 않았습니다");
|
|
}
|
|
|
|
$sessionuser = $this->CI->User_model->get_by_token($app_id, $token);
|
|
|
|
$this->CI->load->helper('email');
|
|
|
|
|
|
$user_email = $this->CI->input->post('user_email');
|
|
|
|
if ( ! $user_email) {
|
|
$this->CI->apilib->make_error("회원 이메일이 입력되지 않았습니다");
|
|
}
|
|
|
|
if ( ! valid_email($user_email) ) {
|
|
$this->CI->apilib->make_error("이메일 형식에 맞지 않습니다.");
|
|
}
|
|
|
|
$userwhere = array(
|
|
'app_id' => $app_id,
|
|
'user_email' => $user_email,
|
|
);
|
|
$row = $this->CI->User_model->get_one('', 'user_id', $userwhere);
|
|
if (element('user_id', $row)) {
|
|
$this->CI->apilib->make_error("이미 사용중인 이메일입니다. 다른 이메일을 입력해주세요.");
|
|
}
|
|
|
|
$arr = array(
|
|
'result' => 'ok',
|
|
'token' => $token,
|
|
'app_id' => $app_id,
|
|
'user_email' => $user_email,
|
|
);
|
|
return $arr;
|
|
}
|
|
}
|