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


PHP bcrypt函数代码示例

本文整理汇总了PHP中bcrypt函数的典型用法代码示例。如果您正苦于以下问题:PHP bcrypt函数的具体用法?PHP bcrypt怎么用?PHP bcrypt使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: doRegister

 public function doRegister(Request $request)
 {
     $validator = Validator::make($data = $request->all(), Admin::$rules, Admin::$messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if ($validator->passes()) {
         $confirmation_code = Str::quickRandom(30);
         $admin = new Admin();
         $admin->fullname = ucwords($request->fullname);
         $admin->mobile_no = $request->mobile_no;
         $admin->email = $request->email;
         $admin->password = bcrypt($request->password);
         $admin->confirmation_code = $confirmation_code;
         $data = ['confirmation_code' => $confirmation_code, 'username' => $request->username, 'password' => $request->password, 'mobile_no' => $request->mobile_no];
         Basehelper::sendSMS($request->mobile_no, 'Hello ' . $request->username . ', you have successfully registere. Your username is ' . $request->username . ' and password is ' . $request->password);
         // Mail::send('emails.verify', $data, function($message) use ($admin, $data){
         // 	$message->from('no-reply@employment_bank', 'Employment Bank');
         //     	$message->to(Input::get('email'), $admin->name)
         //         	->subject('Verify your email address');
         // });
         if (!$admin->save()) {
             return Redirect::back()->with('message', 'Error while creating your account!<br> Please contact Technical Support');
         }
         return Redirect::route('admin.login')->with('message', 'Account has been created!<br>Now Check your email address to verify your account by checking your spam folder or inboxes for verification link after that you can login');
         //sendConfirmation() Will go the email and sms as needed
     } else {
         return Redirect::back()->withInput()->withErrors($validation);
         // ->with('message', 'There were validation errors.');
     }
 }
开发者ID:unicorn-softwares,项目名称:employment_bank,代码行数:31,代码来源:AdminHomeController.php

示例2: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('users', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('email')->unique();
         $table->string('password');
         $table->boolean('active');
         $table->boolean('banned');
         $table->string('register_ip');
         $table->string('country_code');
         $table->string('locale');
         $table->string('activation_key');
         $table->boolean('su');
         $table->rememberToken();
         $table->timestamps();
     });
     $user = \Laralum::newUser();
     $user->name = env('USER_NAME', 'admin');
     $user->email = env('USER_EMAIL', 'admin@admin.com');
     $user->password = bcrypt(env('USER_PASSWORD', 'admin123'));
     $user->active = true;
     $user->banned = false;
     $user->register_ip = "";
     $user->country_code = env('USER_COUNTRY_CODE', 'ES');
     $user->locale = env('USER_LOCALE', 'en');
     $user->activation_key = str_random(25);
     $user->su = true;
     $user->save();
 }
开发者ID:ConsoleTVs,项目名称:Laralum,代码行数:35,代码来源:2014_10_12_000000_create_users_table.php

示例3: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     // Create level 0 : member
     Level::create(['level' => 0, 'name' => 'membre']);
     // Create level 1 : band_creator
     Level::create(['level' => 1, 'name' => 'manager']);
     // Create level 2 : teacher
     Level::create(['level' => 2, 'name' => 'professeur']);
     // Create level 3 : admin
     Level::create(['level' => 3, 'name' => 'admin']);
     // Create level 10 : webmaster
     Level::create(['level' => 10, 'name' => 'webmaster']);
     // Create departement : "aucun"
     Department::create(['name' => 'Aucun', 'short_name' => 'Aucun']);
     // Create user : Webmaster (lvl 10)
     User::create(['first_name' => 'Webmaster', 'last_name' => 'Webmaster', 'email' => 'webm@ster', 'school_year' => 0, 'department_id' => 1, 'password' => bcrypt('webmastercmt'), 'level_id' => 5, 'slug' => 'webmaster-webmaster-1']);
     Category::create(['name' => 'Aucune']);
     Category::create(['name' => 'Autre']);
     Category::create(['name' => 'Présentation']);
     Category::create(['name' => 'Création de groupe']);
     Category::create(['name' => 'Recherche de groupe']);
     Category::create(['name' => 'Échange/Vente']);
     //Creation basic instruments :
     $instruments = ['autre', 'guitare', 'piano', 'basse', 'chant', 'flûte', 'violon', 'contrebasse', 'clarinette', 'saxophone', 'batterie', 'violoncelle', 'guitare électrique', 'flûte traversière', 'trompette', 'cor', 'trombone', 'tuba'];
     $this->create_instrument($instruments);
 }
开发者ID:Techraav,项目名称:PolyMusic,代码行数:31,代码来源:2017_03_04_153520_create_base_entries.php

示例4: addMember

 public function addMember()
 {
     $password = str_random(6);
     $phone = Input::get('phone');
     $cityid = Input::get('city');
     $user_id = DB::table('users')->insertGetId(['full_name' => Input::get('full_name'), 'email' => Input::get('email'), 'password' => bcrypt($password), 'role_id' => 3, 'location_id' => Input::get('city'), 'phone_number' => $phone]);
     $data = array('full_name' => Input::get('full_name'), 'email' => Input::get('email'), 'phone_number' => Input::get('phone'));
     if ($user_id) {
         DB::table('user_attributes_varchar')->insert(['user_id' => $user_id, 'user_attribute_id' => 7, 'attribute_value' => '1' . str_pad($user_id, 6, '0', STR_PAD_LEFT)]);
         $createPasswordRequest = Password::creatRequestWebsitePassword($data);
         $createPasswordRequest['password'] = $password;
         Mail::send('site.pages.website_admin_registration', ['data' => $createPasswordRequest], function ($message) use($createPasswordRequest) {
             $message->from('concierge@wowtables.com', 'WowTables by GourmetItUp');
             $message->to($createPasswordRequest['email'])->subject('You have been registered as a WowTables member!');
         });
         $city_name = Location::where(['Type' => 'City', 'id' => $cityid])->pluck('name');
         if (empty($city_name)) {
             $city_name = 'mumbai';
         }
         $city = ucfirst($city_name);
         $merge_vars = array('NAME' => isset($createPasswordRequest['userName']) ? $createPasswordRequest['userName'] : '', 'SIGNUPTP' => 'Email', 'BDATE' => '', 'GENDER' => '', 'MERGE11' => 0, 'MERGE17' => 'Admin added account', 'PHONE' => isset($phone) ? $phone : '', 'GROUPINGS' => array(array('id' => 9713, 'groups' => [$city])));
         $this->mailchimp->lists->subscribe($this->listId, ["email" => $createPasswordRequest['email']], $merge_vars, "html", false, true);
         $my_email = $createPasswordRequest['email'];
         $success_message = "Email " . $my_email . " has been registered as a member.";
         $data = array('user_id' => $user_id, 'success_message' => $success_message);
         echo json_encode($data);
     }
 }
开发者ID:Charu91,项目名称:Wowtables1,代码行数:28,代码来源:AdminReservationsController.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     User::create(['name' => 'Patrick Jane', 'email' => 'jane@cbi.com', 'password' => bcrypt('patrickJane'), 'is_admin' => true]);
     User::create(['name' => 'Teresa Lisbon', 'email' => 'lisbon@cbi.com', 'password' => bcrypt('teresaLisbon'), 'is_admin' => true]);
     User::create(['name' => 'Juergen Kraßnig', 'email' => 'kra16589@spengergasse.at', 'password' => bcrypt('juergen'), 'is_admin' => true]);
     User::create(['name' => 'King Mo', 'email' => 'haf16570@spengergasse.at', 'password' => bcrypt('mojtaba')]);
 }
开发者ID:starkbaum,项目名称:sucon,代码行数:12,代码来源:UsersSeeder.php

示例6: it_fires_NewRegisteredUser_event_and_links_user

 /**
  * @covers App\Events\NewRegisteredUser::__construct
  * @covers App\Handlers\Events\LinkUserToExistingContacts::handle
  * @test
  */
 public function it_fires_NewRegisteredUser_event_and_links_user()
 {
     $contact = $this->createContact(['email' => 'guest@example.org']);
     $user = $this->createUser(['email' => 'guest@example.org', 'password' => bcrypt('demoguest')]);
     event(new NewRegisteredUser($user));
     $this->seeInDatabase('contacts', ['email' => $user->email, 'user_id' => $user->id]);
 }
开发者ID:ancchaimongkon,项目名称:timegrid,代码行数:12,代码来源:NewRegisteredUserUnitTest.php

示例7: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
     $mailer = new AppMailer();
     $mailer->sendEmailConfirmationTo($user);
     return $user;
 }
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:13,代码来源:AuthController.php

示例8: registerEventListeners

 /**
  * Registers the event listeners for the model.
  * @return void
  */
 protected static function registerEventListeners()
 {
     //Intercept the saving method and bcrypt the password
     static::creating(function ($user) {
         $user->password = bcrypt($user->password);
     });
 }
开发者ID:AlexCW,项目名称:LaravelUserApp,代码行数:11,代码来源:User.php

示例9: setPasswordAttribute

 public function setPasswordAttribute($value)
 {
     //$passnew ="fernando";
     if (!empty($value)) {
         $this->attributes['password'] = bcrypt($value);
     }
 }
开发者ID:GabrielEduardoO,项目名称:pasoapasolaravel,代码行数:7,代码来源:sw_usuario.php

示例10: run

 public function run()
 {
     //DB::table('forsidas')->delete();
     Forsida::create(['frettdagsins' => 'ekkert i dag']);
     User::create(['username' => 'administrator', 'password' => bcrypt('root123'), 'email' => 'admin@admin.com', 'profilephoto' => '/images/Administrator.jpg', 'firstname' => 'Alfa']);
     User::create(['username' => 'administrator2', 'password' => bcrypt('root1234'), 'email' => 'admin2@admin2.com', 'profilephoto' => '/images/Administrator.jpg', 'firstname' => 'Alfa']);
 }
开发者ID:krilliman,项目名称:Kristmann,代码行数:7,代码来源:DatabaseSeeder.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6']);
     // TODO: сделать проверку прав на создание пользователя
     $user = \App\User::create(['name' => $request->get('name'), 'email' => $request->get('email'), 'password' => bcrypt($request->get('password'))]);
     return $user;
 }
开发者ID:serovvitaly,项目名称:new.jp.appros.ru,代码行数:13,代码来源:UserController.php

示例12: run

 /**
  * Run the database seeds.
  */
 public function run()
 {
     $faker = Faker\Factory::create('id_ID');
     App\Guru::create(['nip' => '000', 'nama' => $faker->name, 'username' => '000', 'password' => bcrypt('000'), 'staf' => 1]);
     App\Guru::create(['nip' => '111', 'nama' => $faker->name, 'username' => '111', 'password' => bcrypt('111'), 'staf' => 2]);
     App\Guru::create(['nip' => '555', 'nama' => $faker->name, 'username' => '555', 'password' => bcrypt('555'), 'staf' => 0]);
 }
开发者ID:hermitpopcorn,项目名称:arkxiii,代码行数:10,代码来源:DataGuruTest.php

示例13: create

 public function create(array $data)
 {
     $data['user']['password'] = bcrypt(123456);
     $user = $this->userRepository->create($data['user']);
     $data['user_id'] = $user->id;
     $this->clientRepository->create($data);
 }
开发者ID:ambrodrigues,项目名称:laravel-codedelivery,代码行数:7,代码来源:ClientService.php

示例14: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call('UserTableSeeder');
     \App\Editor::create(['first_name' => 'Andy', 'last_name' => 'Crockett', 'email' => 'andy@hardystudio.com', 'password' => bcrypt('cotton')]);
     Model::reguard();
 }
开发者ID:andycrockett,项目名称:andycrockett,代码行数:12,代码来源:DatabaseSeeder.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('categories')->truncate();
     DB::table('categories')->insert(array(array('name' => 'Браслеты', 'url' => 'bracelets', 'created_at' => DB::raw('NOW()'), 'updated_at' => DB::raw('NOW()')), array('name' => 'Сережки', 'url' => 'earrings', 'created_at' => DB::raw('NOW()'), 'updated_at' => DB::raw('NOW()')), array('name' => 'Кольца', 'url' => 'rings', 'created_at' => DB::raw('NOW()'), 'updated_at' => DB::raw('NOW()')), array('name' => 'Кулоны', 'url' => 'pendants', 'created_at' => DB::raw('NOW()'), 'updated_at' => DB::raw('NOW()')), array('name' => 'Разное', 'url' => 'misc', 'created_at' => DB::raw('NOW()'), 'updated_at' => DB::raw('NOW()'))));
     DB::table('users')->truncate();
     DB::table('users')->insert(array('name' => 'admin', 'email' => 'cspook@rambler.ru', 'password' => bcrypt('123456789'), 'created_at' => DB::raw('NOW()'), 'updated_at' => DB::raw('NOW()')));
 }
开发者ID:Qeenslet,项目名称:wireworks,代码行数:12,代码来源:UserTableSeeder.php


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