duanjiao5082 2014-10-09 03:20
浏览 82

接受数据库中通过哈希加密的用户名

When I'm creating a user, the username and password saves in a hash. Now I want my username and password when log in, can be read by the system. I am using Laravel

Below is my code for user controller

public function postSignin() {
        if (Auth::attempt(array('username'=>Input::get('username'), 'password'=>Input::get('password')))) {
            return Redirect::to('admin/dashboard')->with('message', 'You are now logged in!');
        } else {
            return Redirect::to('users/login')
             ->with('message', 'Your username/password combination was incorrect')
             ->withInput();
            }
        }
  • 写回答

1条回答 默认 最新

  • dongliming2416 2014-10-09 04:08
    关注

    Case sensitivity does not require hashing. You use a non _CI encoding in the database table. CI stands for case insensitive.

    Assuming that you still want to hash the username, you would just need to hash the user input (username), in the same manner it is stored in the database, before passing it to the authentication script.

    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动