소스 검색

Cambio de contraseña a usuarios de firebase

Hugo Quijada 2 년 전
부모
커밋
500d4a39e2
1개의 변경된 파일29개의 추가작업 그리고 0개의 파일을 삭제
  1. 29 0
      commands/UsuarioController.php

+ 29 - 0
commands/UsuarioController.php

@@ -197,4 +197,33 @@ class UsuarioController extends Controller {
       }
     } while ($continuar);
   }
+
+  public function actionCambiarClave($uid, $clave) {
+    if(trim($uid) === "" || trim($clave) === "") {
+      return $this->stdout("Los parámetros uid y clave son obligatorios\n");
+    }
+
+    $firebase = new FirebaseHelper();
+    $auth = $firebase->authentication();
+
+    $res = $auth->changeUserPassword($uid, $clave);
+
+    $this->stdout("Proceso terminado \n");
+  }
+
+  public function actionCambiarTelefono($uid, $telefono) {
+    if(trim($uid) === "" || trim($telefono) === "") {
+      return $this->stdout("Los parámetros uid y telefono son obligatorios\n");
+    }
+
+    $firebase = new FirebaseHelper();
+    $auth = $firebase->authentication();
+
+    $telefono = trim($telefono);
+
+    $propiedades = ["phoneNumber" => "+52{$telefono}"];
+    $res = $auth->updateUser($uid, $propiedades);
+
+    $this->stdout("Proceso terminado \n");
+  }
 }