app/Http/Controllers/LoginController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $data =$request->all();
        $this->validate($request,[
            'email'    => 'required|email',
            'password' => 'required|min:6'
        ]);
        $loginpassword = md5(md5($data['password'].$data['email']));
        $email = self::$user->checkUserEmail(['email' => $data['email']]);
        if(!$email) {
            return  back()->withErrors('用户不存在，请注册');
        }
        $userinfo = self::$user->getUserInfo(['email' => $data['email']]);
        if($loginpassword != $userinfo->password ){
            return  back()->withErrors('密码错误！');
        }
        Session::put('user',$userinfo);
        return redirect('/user');
    }
public function store ( Request $ request ) { $ data = $ request -> all ( ) ; $ this -> validate ( $ request , [ 'email' => 'required|email' , 'password' => 'required|min:6' ] ) ; $ loginpassword = md5 ( md5 ( $ data [ 'password' ] . $ data [ 'email' ] ) ) ; $ email = self :: $ user -> checkUserEmail ( [ 'email' => $ data [ 'email' ] ] ) ; if ( ! $ email ) { return back ( ) -> withErrors ( '用户不存在，请注册'); } $ userinfo = self :: $ user -> getUserInfo ( [ 'email' => $ data [ 'email' ] ] ) ; if ( $ loginpassword != $ userinfo -> password ) { return back ( ) -> withErrors ( '密码错误！'); } Session :: put ( 'user' , $ userinfo ) ; return redirect ( '/user' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//获取用户输入密码