当前位置: 首页>>代码示例>>PHP>>正文


PHP Crypt::encrypt方法代码示例

本文整理汇总了PHP中Crypt::encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Crypt::encrypt方法的具体用法?PHP Crypt::encrypt怎么用?PHP Crypt::encrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Crypt的用法示例。


在下文中一共展示了Crypt::encrypt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDecrypt

 /**
  * Tests Crypt->decrypt()
  */
 public function testDecrypt()
 {
     // Encrypt the data
     $encrypted = $this->crypt->encrypt(self::DATA);
     // Decrypt the data
     $decrypted = $this->crypt->decrypt($encrypted);
     $this->assertTrue($decrypted == self::DATA, 'Testing data decryption');
     unset($encrypted, $decrypted);
 }
开发者ID:spekkionu,项目名称:spekkionu-php-class-collection,代码行数:12,代码来源:CryptTest.php

示例2: index

 public function index()
 {
     $encryptedkey = Crypt::encrypt("joomla");
     Config::set('session.driver', 'native');
     Session::put('api_key', $encryptedkey);
     return Response::json(array('status' => 'OK', '_token' => $encryptedkey));
 }
开发者ID:eufelipemartins,项目名称:edlara,代码行数:7,代码来源:ApiController.php

示例3: postLogin

 public function postLogin(Request $request)
 {
     $this->validate($request, ['user_id' => 'required', 'password' => 'required']);
     $credentials = $request->only('user_id', 'password');
     $redirect = $this->redirectPath();
     $lock_new_users = true;
     $try = false;
     if (User::find($credentials['user_id'])) {
         // The user exists
         $try = true;
     } else {
         if ($lock_new_users) {
             return redirect('/locked');
         } else {
             if (($person = Person::find($credentials['user_id'])) && DataSource::check_login($credentials['user_id'], $credentials['password'])) {
                 // The ID exists and details are correct, but there isn't an account for it. Make one.
                 $user = User::create(['user_id' => $credentials['user_id'], 'name' => $person->name, 'password' => \Crypt::encrypt($credentials['password']), 'is_queued' => true]);
                 \Queue::push(new PrepareUser($user));
                 $redirect = '/setup';
                 $try = true;
             }
         }
     }
     if ($try && Auth::attempt($credentials, $request->has('remember'))) {
         return redirect()->intended($redirect);
     }
     return redirect($this->loginPath())->withInput($request->only('user_id', 'remember'))->withErrors(['user_id' => $this->getFailedLoginMessage()]);
 }
开发者ID:oeed,项目名称:Keystone-Next,代码行数:28,代码来源:AuthController.php

示例4: setAttribute

 /**
  * Encrypt value
  *
  * @param  string $key
  * @param  mixed  $value
  * @return $this
  */
 public function setAttribute($key, $value)
 {
     if (in_array($key, $this->encryptable)) {
         return parent::setAttribute($key, \Crypt::encrypt($value));
     }
     return parent::setAttribute($key, $value);
 }
开发者ID:it-can,项目名称:laravel-model-traits,代码行数:14,代码来源:Encryptable.php

示例5: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $gateways = DB::table('account_gateways')->get(['id', 'config']);
     foreach ($gateways as $gateway) {
         DB::table('account_gateways')->where('id', $gateway->id)->update(['config' => Crypt::encrypt($gateway->config)]);
     }
 }
开发者ID:magicians,项目名称:invoiceninja,代码行数:12,代码来源:2015_11_01_080417_encrypt_tokens.php

示例6: create

 /**
  * Show the form for creating a new resource.
  * POST /account/create
  *
  * @return Response
  */
 public function create()
 {
     //perform Register Action
     $rules = ['email' => 'required|email|unique:users', 'password' => 'required|min:6'];
     $v = Validator::make(Input::all(), $rules);
     if ($v->fails()) {
         return Redirect::route('register')->withErrors($v)->withInput();
     } else {
         $users = new User();
         $users->first_name = Input::get('fname');
         $users->last_name = Input::get('lname');
         $users->username = Input::get('username');
         $users->email = Input::get('email');
         $users->password = Hash::make(Input::get('password'));
         $send = $users->save();
         if ($send) {
             Mail::send('emails.activation', array('key' => Crypt::encrypt(Input::get('email'))), function ($message) {
                 $message->to(Input::get('email'), Input::get('fname') . ' ' . Input::get('lname'))->subject('Welcome! Please Activate Your Account');
             });
             $newUser = User::find($users->id);
             Auth::login($newUser);
             return Redirect::to('home');
         }
     }
 }
开发者ID:kukuhnovaputra,项目名称:ta,代码行数:31,代码来源:AccountController.php

示例7: postCreate

 public function postCreate()
 {
     $rules = array('txtRol' => 'required|numeric|min:1', 'txtEmail' => 'required|email|min:8|max:100', 'txtPassword' => 'required|min:6|max:100', "txtNombres" => "required|min:2|max:100", "txtApellidos" => "required|min:2|max:100", "username" => "required|min:3|max:20|unique:users", "txtEstado" => "required|numeric|min:0|max:1");
     $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :min carácteres.', 'unique' => 'El :attribute ingresado ya existe en la base de datos', "numeric" => "El campo :attribute debe ser un numero");
     $friendly_names = array('username' => 'Nombre de Usuario', 'txtPassword' => 'Contraseña', "txtNombres" => "Nombres", "txtApellidos" => "Apellidos", "txtEstado" => "Estado", "txtEmail" => "Email", "txtRol" => "Rol");
     $validation = Validator::make(Input::all(), $rules, $messages);
     $validation->setAttributeNames($friendly_names);
     if ($validation->fails()) {
         return Redirect::to('usuarios/ausuario')->withErrors($validation)->withInput();
     } else {
         DB::transaction(function () {
             $usuario = new Usuario();
             $usuario->roles_id = Input::get("txtRol");
             $usuario->nombres = Input::get("txtNombres");
             $usuario->apellidos = Input::get("txtApellidos");
             $usuario->email = Input::get("txtEmail");
             $usuario->password = Hash::make(Input::get("txtPassword"));
             $usuario->contrasenia = Crypt::encrypt(Input::get("txtPassword"));
             $usuario->username = Input::get("username");
             $usuario->fechaCreacion = new DateTime();
             $usuario->estado = Input::get("txtEstado");
             $usuario->save();
         });
         return Redirect::to("admin")->with("insertar", true);
     }
 }
开发者ID:omarmurcia,项目名称:AHJNProject,代码行数:26,代码来源:UsuariosController.php

示例8: saveUserInfo

 public function saveUserInfo()
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     $code = \Input::get('code');
     $lti = \Input::get('lti');
     $instanceFromDB = LtiConfigurations::find($lti);
     $clientId = $instanceFromDB['DeveloperId'];
     $developerSecret = $instanceFromDB['DeveloperSecret'];
     $opts = array('http' => array('method' => 'POST'));
     $context = stream_context_create($opts);
     $url = "https://{$_SESSION['domain']}/login/oauth2/token?client_id={$clientId}&client_secret={$developerSecret}&code={$code}";
     $userTokenJSON = file_get_contents($url, false, $context, -1, 40000);
     $userToken = json_decode($userTokenJSON);
     $actualToken = $userToken->access_token;
     $encryptedToken = \Crypt::encrypt($actualToken);
     $_SESSION['userToken'] = $encryptedToken;
     //store encrypted token in the database
     $courseId = $_SESSION['courseID'];
     $userId = $_SESSION['userID'];
     $user = new User();
     $user->user_id = $userId;
     $user->course_id = $courseId;
     $user->encrypted_token = $encryptedToken;
     $user->save();
     echo "App has been approved. Please reload this page";
 }
开发者ID:Bagelllama,项目名称:delphinium,代码行数:28,代码来源:OAuthResponse.php

示例9: create

 public function create()
 {
     $data = Input::all();
     $promo = new Promo();
     $promo->days = Input::get('days');
     $promo->code = Crypt::encrypt(Input::get('code'));
     $promo->status = 0;
     $promo->colony_id = Input::get('colony_id');
     if ($promo->save()) {
         $user_id = Input::get('admin_colonia');
         $admin_user = DB::connection('habitaria_dev')->select('select email from users where id = ? ', [$user_id]);
         foreach ($admin_user as $user) {
             $admin_email = $user->email;
         }
         $admin_neighbor = Neighbors::where('user_id', '=', $user_id)->first();
         $colony_data = Colony::where('id', '=', $promo->colony_id)->first();
         $colony_name = $colony_data->name;
         $data = array('email' => $admin_email, 'days' => $promo->days, 'code' => Crypt::decrypt($promo->code), 'colony' => $colony_name, 'admin' => $admin_neighbor->name . ' ' . $admin_neighbor->last_name);
         Mail::send('emails.cupon_promo', $data, function ($message) use($admin_email) {
             $message->subject('Promo de HABITARIA');
             $message->to($admin_email);
         });
         $notice_msg = 'Promo enviada al administrador de la Colonia: ' . $colony_name;
         return Redirect::action('PromoController@report_promo', $promo->colony_id)->with('error', false)->with('msg', $notice_msg)->with('class', 'info');
     }
 }
开发者ID:prianticonsulting,项目名称:Habitaria,代码行数:26,代码来源:PromoController.php

示例10: saveUserInfo

 public function saveUserInfo()
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     $code = \Input::get('code');
     $lti = \Input::get('lti');
     $instanceFromDB = LtiConfigurations::find($lti);
     $clientId = $instanceFromDB['DeveloperId'];
     $developerSecret = $instanceFromDB['DeveloperSecret'];
     $opts = array('http' => array('method' => 'POST'));
     $context = stream_context_create($opts);
     $url = "https://{$_SESSION['domain']}/login/oauth2/token?client_id={$clientId}&client_secret={$developerSecret}&code={$code}";
     $userTokenJSON = file_get_contents($url, false, $context, -1, 40000);
     $userToken = json_decode($userTokenJSON);
     $actualToken = $userToken->access_token;
     $encryptedToken = \Crypt::encrypt($actualToken);
     $_SESSION['userToken'] = $encryptedToken;
     //store encrypted token in the database
     $courseId = $_SESSION['courseID'];
     $userId = $_SESSION['userID'];
     //make sure we have the user stored in the user table and in the userCourse table.
     $roots = new Roots();
     //when we get the user from the LMS it gets stored in the DB.
     $roots->getUser($userId);
     $dbHelper = new DbHelper();
     $role = $dbHelper->getRole('Approver');
     $userCourse = UserCourse::firstOrNew(array('user_id' => $userId, 'course_id' => $courseId));
     $userCourse->user_id = $userId;
     $userCourse->course_id = $courseId;
     $userCourse->role = $role->id;
     $userCourse->encrypted_token = $encryptedToken;
     $userCourse->save();
     echo "App has been approved. Please reload this page";
 }
开发者ID:Poornimagaurav,项目名称:delphinium,代码行数:35,代码来源:OAuthResponse.php

示例11: _updatePerfil

 private function _updatePerfil($status_image)
 {
     if ($status_image == 'no_image') {
         // No subió ninguna imágen
         $id = Auth::id();
         $user = User::find($id);
         $user->name = Input::get('name');
         $user->last_name = Input::get('lastname');
         $user->email = Input::get('email');
         $user->password = Crypt::encrypt(Input::get('password'));
         $user->save();
         return true;
     } else {
         // Subió una imágen nueva.
         $save_name_file = date('Y.m.d.H_m_s') . Input::file('file')->getClientOriginalName();
         $file_move = Input::file('file')->move(public_path() . '/uploads/perfil/', $save_name_file);
         if ($file_move) {
             $id = Auth::id();
             $user = User::find($id);
             $user->name = Input::get('name');
             $user->last_name = Input::get('lastname');
             $user->email = Input::get('email');
             $user->password = Crypt::encrypt(Input::get('password'));
             $user->image = $save_name_file;
             $user->save();
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:jpasosa,项目名称:administracion,代码行数:31,代码来源:PerfilController.php

示例12: postNew

 public function postNew()
 {
     if (Input::has('save')) {
         if (Input::get('employee') == 0 || Input::get('organization') == 0 || Input::get('r_plan') == 0 || Input::get('specialist') == 0 || strlen(Input::get('title')) < 2 || strlen(Input::get('description')) < 2) {
             Session::flash('sms_warn', trans('sta.require_field'));
         } else {
             $request = new RRequest();
             $request->request_by_id = Input::get('employee');
             $request->for_organization_id = Input::get('organization');
             $request->for_planning_id = Input::get('r_plan');
             $request->to_department_id = Input::get('specialist');
             $request->request_title = Input::get('title');
             $request->description = Input::get('description');
             $request->request_date = date('Y-m-d');
             $request->created_by = Auth::user()->employee_id;
             if ($request->save()) {
                 Session::flash('sms_success', trans('sta.save_data_success'));
                 return Redirect::to('branch_request/general/' . Crypt::encrypt($request->id));
             }
         }
     }
     $organizations = $this->array_list(Organization::list_item());
     $employees = $this->array_list(Employee::list_item());
     $department = $this->array_list(Department::list_item());
     $r_plans = $this->array_list(Rplan::list_item());
     return View::make('branch_request.new', array('organizations' => $organizations, 'employees' => $employees, 'specialist' => $department, 'r_plans' => $r_plans));
 }
开发者ID:ravysin,项目名称:testgithub,代码行数:27,代码来源:BranchRequestController.php

示例13: check

 private function check($d)
 {
     global $LANGUAGES;
     if (!Data::checkFilled($d['language'])) {
         Error::msg("Por favor, escolha uma linguagem.", __METHOD__);
     }
     if (!in_array($d['language'], array_keys($LANGUAGES))) {
         Error::msg("A linguagem '" . $d['language'] . "' não é válida", __METHOD__);
     }
     if (empty($d['source'])) {
         Error::msg("Por favor, preencha o campo <b>código fonte</b>.", __METHOD__);
     }
     require_once b1n_PATH_LIB . "/Crypt.lib.php";
     $seccode = $d['seccode'];
     $seccode = Crypt::encrypt(strtolower($seccode));
     if (!isset($_SESSION['seccode'])) {
         Error::msg("Digite o que está escrito na imagem corretamente.", __METHOD__);
     }
     if (strcmp($seccode, $_SESSION['seccode']) != 0) {
         Error::msg("Digite o que está escrito na imagem corretamente.", __METHOD__);
     }
     $md5 = md5($d['source']);
     $query = "SELECT pas_id FROM paste WHERE pas_md5 = '" . $md5 . "'";
     $rs = $this->sql->singleQuery($query);
     if (is_array($rs) && count($rs)) {
         $id = base_convert($rs['pas_id'], 10, b1n_CODE_BASE);
         $url = b1n_URL_ID . $id;
         Error::msg("Já existe um código igual a esse no banco de dados.<br />\n         Veja: <a href='{$url}'>{$url}</a>", __METHOD__);
     }
     return true;
 }
开发者ID:mmr,项目名称:b1n,代码行数:31,代码来源:Paste.lib.php

示例14: Create

 public function Create()
 {
     $rules = array('username' => 'required', 'level' => 'required', 'names' => 'required', 'last_name' => 'required', 'ci_num' => 'required', 'correo' => 'required|email', 'telephone' => 'required|numeric', 'adress' => 'required', 'password' => 'required');
     $validacion = Validator::make(Input::all(), $rules);
     if ($validacion->fails()) {
         return Redirect::back()->withErrors($validacion);
     } else {
         $password = Input::get('password');
         $persona = new Persona();
         $user = new User();
         $persona->nombres = Input::get('names');
         $persona->apellidos = Input::get('last_name');
         $persona->ci = Input::get('ci_num');
         $persona->telefono = Input::get('telephone');
         $persona->direccion = Input::get('adress');
         $persona->save();
         $persona = Persona::where('ci', '=', Input::get('ci_num'))->first();
         $user->username = Input::get('username');
         $user->password = Hash::make($password);
         $user->encry = Crypt::encrypt($password);
         $user->nivel = Input::get('level');
         $user->email = Input::get('correo');
         $user->persona_id = $persona->id;
         $user->save();
         return Redirect::to('admi')->with('status', 'ok_create');
     }
 }
开发者ID:gabitoooo,项目名称:inventarios,代码行数:27,代码来源:AdminController.php

示例15: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Requests\SignUpRequest $request)
 {
     //
     $usermodel = new User();
     $all = $request->all();
     try {
         $password = $all["password"];
         $payload = \Crypt::encrypt($password);
         $all["password"] = $payload;
         $all['role'] = 5;
         if (isset($all['_token'])) {
             unset($all['_token']);
         }
         $user = $usermodel->newUser($all);
         if ($user) {
             $login = $this->login($all);
             return $login;
         }
         dd("signup failed!");
     } catch (Exception $e) {
         $message = $e->getMessage();
         $code = $e->getCode();
         dd(["message" => $message, "code" => $code]);
     }
 }
开发者ID:kits2code,项目名称:ignore,代码行数:31,代码来源:SignUpController.php


注:本文中的Crypt::encrypt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。