Procházet zdrojové kódy

Cambio de contraseña a usuarios de firebase

Hugo Quijada před 2 roky
rodič
revize
500d4a39e2
1 změnil soubory, kde provedl 29 přidání a 0 odebrání
  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");
+  }
 }