普通登录
()
| 33 | |
| 34 | // 普通登录 |
| 35 | func (this *CommonController) Login() { |
| 36 | username := this.GetString("username") //username or email |
| 37 | password := this.GetString("password") |
| 38 | member, err := models.NewMember().GetByUsername(username) |
| 39 | if err != nil { |
| 40 | if err == orm.ErrNoRows { |
| 41 | this.Response(http.StatusBadRequest, messageUsernameOrPasswordError) |
| 42 | } |
| 43 | beego.Error(err) |
| 44 | this.Response(http.StatusInternalServerError, messageInternalServerError) |
| 45 | } |
| 46 | if err != nil { |
| 47 | beego.Error(err) |
| 48 | this.Response(http.StatusInternalServerError, messageInternalServerError) |
| 49 | } |
| 50 | if ok, _ := utils.PasswordVerify(member.Password, password); !ok { |
| 51 | beego.Error(err) |
| 52 | this.Response(http.StatusBadRequest, messageUsernameOrPasswordError) |
| 53 | } |
| 54 | this.login(member) |
| 55 | } |
| 56 | |
| 57 | func (this *CommonController) LoginedBindWechat() { |
| 58 | username := this.GetString("username") //username or email |
nothing calls this directly
no test coverage detected