public static function AuthorizedUserToResetThePassword($params) { $model = ApiParams::checkRequiredParams($params, ApiParams::$REQUIRED_RESTORE_PASSWORD_PARAMS); if ($model->errors) { return $model; } else { $new_model = RecipientMobileLogin::getUserByDeviceID($params[ApiParams::DEVICE_ID]); if (!$new_model) { $model->addError(RecipientMobileLogin::DEVICE_ID, $error = self::DEVICE_ID_ERROR_MESSAGE); return $model; } else { $model = self::checkloginParams($new_model, $params, true); } return $model; } }
/** * Returns the fully qualified parent class name. * * @return string */ public static function extendsFrom() { return RecipientMobileLogin::className(); }
public function actionChangeProfileInfo() { $params = ApiParams::getPostJsonParams(); $model = Validation::checkParams($params, ApiParams::$CHANGE_PROFILE_PARAMS); if ($model->errors) { Utils::echoErrorResponse($model->getFirstErrors()); } else { $model = RecipientMobileLogin::findOne([RecipientMobileLogin::INDEX => $model->recipient_mobile_index]); $setting = RecipientMobileSetting::findOne([RecipientMobileSetting::RECIPIENT_MOBILE_INDEX => $model->index]); $recipient = Recipients::find()->where(['code' => $model->recipient_code])->one(); $recipient->name = $params[ApiParams::USER_NAME]; $model->recipient_code = $params[ApiParams::USER_CODE]; $model->mobile_password = $params[ApiParams::USER_PASSWORD]; $setting->unlock_code = $params[ApiParams::UNLOCK_CODE]; $setting->location_support = $params[ApiParams::IS_LOCATION]; if (!$setting->save() || !$model->save() || !$recipient->save()) { Utils::echoErrorResponse("something went wrong with the server, please try again later"); } else { $response = $this->userJson($model, $setting); Utils::echoSuccessResponse($response); } } }