示例#1
0
 /**
  * Carrega un usuari amb el seu telèfon... sempre que s'estigui a la part d'administració
  **/
 public function getUsuariByTelefon()
 {
     $R = $this->getAjaxData();
     $CTO = new ClientTableObject();
     $CTO->loadByTelefon($R['telefon']);
     echo json_encode($CTO);
 }
示例#2
0
 /**
  * Recorda contrasenya
  **/
 public function ajaxRemember()
 {
     $R = $this->getAjaxData();
     $CTO = new ClientTableObject();
     if (!isset($R['TelefonUsuari']) || empty($R['TelefonUsuari'])) {
         throw new MyException("Has d'entrar un número telefònic per recordar la contrasenya.");
     }
     $CTO->loadByTelefon($R['TelefonUsuari']);
     //Canvio el password directament
     $Password = G::RandomString();
     $CTO->setPassword($Password);
     $CTO->doSave();
     //Envio el nou password al correu electrònic
     if (!G::sendEmailRemember($CTO->client['c_Email'], $Password)) {
         throw new MyException("No s'ha pogut enviar la nova contrasenya per un problema amb el correu. Si us plau, intenti-ho mes tard.");
     }
 }