Commit 10b14ed5 by Wittaya-PIM

Merge branch 'integration' into wittaya

parents 1fa2031a 68b33d4e
......@@ -4,4 +4,4 @@ www/tmp/
www/webroot/img/img/demos/shop/products/shop8/product2.jpg
www/webroot/img/img/demos/
www/src/Controller/UsersController.php.bg20180515
www/config/app.backup
www/config/app - Copy.php
......@@ -3,29 +3,11 @@ namespace App\Controller;
use App\Controller\AppController;
class CheckemailsController extends AppController {
public function checkemailregister(){
// die('jjjjj');
$this->autoRender = false;
if ($this->request->is('post')) {
$this->loadModel('UserPersonals');
$emails = $this->UserPersonals->find('all',[
'conditions' => [
'email' => $this->request->data['email']
]
])->first();
if(!empty($emails)&&$emails['email']!=''&&$emails['email']!='-'){
$emails['chk'] = 'false';
$data = json_encode($emails);
echo $data;
}else{
$emails['chk'] = 'true';
$data = json_encode($emails);
echo $data;
}
}
}
public function checkemailedit(){
public function initialize() {
parent::initialize();
$this->Auth->allow('checkemail');
}
public function checkemail(){
// die('jjjjj');
$this->autoRender = false;
if ($this->request->is('post')) {
......@@ -36,20 +18,24 @@ class CheckemailsController extends AppController {
]
])->first();
if(!empty($emails)&&$emails['email']!=''&&$emails['email']!='-'){
if($this->request->data['userId'] == $emails['user_id']){
$emails['chk'] = 'true';
$data = json_encode($emails);
echo $data;
} else {
if(!empty($this->request->data['userId'])){
if($this->request->data['userId'] == $emails['user_id']){
$emails['chk'] = 'true';
$data = json_encode($emails);
echo $data;
}
$emails['chk'] = 'false';
$data = json_encode($emails);
echo $data;
}
$emails['chk'] = 'false';
$data = json_encode($emails);
echo $data;
}else{
$emails['chk'] = 'true';
$data = json_encode($emails);
echo $data;
}
}
}
}
}
}
\ No newline at end of file
......@@ -212,7 +212,7 @@
$("#email").on('change',function(){
var userId = document.getElementById("userId").value;
var email = document.getElementById("email").value;
$.post("/Checkemails/checkemailedit", {email: email,userId: userId}, function(data) {
$.post("/Checkemails/checkemail", {email: email,userId: userId}, function(data) {
// console.log(data);
data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){
......
......@@ -180,8 +180,8 @@
$(document).ready(function() {
$("#fremail").on('change',function(){
var email = document.getElementById("fremail").value;
$.post("/Checkemails/checkemailregister", {email: email}, function(data) {
// console.log(data);
$.post("/Checkemails/checkemail", {email: email}, function(data) {
console.log(data);
data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){
alert("อีเมลล์นี้มีในระบบแล้ว");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment