什么是角Strongloop应用更改密码的正确方法是什么? [英] What is the correct way to change password in Angular-Strongloop app?

查看:211
本文介绍了什么是角Strongloop应用更改密码的正确方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过文档看,SO和interwebs,无法找到,显示了如何为用户,密码可以是一个Strongloop后端并使用由SLC产生的AngularJS API应用程序来改变一个例子。高AP preciate指针在正确的方向。

I have looked through docs, SO and the interwebs, unable to find an example that shows how the password for a User can be changed with a Strongloop backend and an app using the AngularJS API generated by slc. Highly appreciate pointers in the right direction.

更新
我不是在寻找重置密码是忘记了密码的情况下。
我在寻找改变那里的老通以及新通需要提供并设置新的通以前的老通将被验证合法的途径。

Update I'm not looking for the reset password which is the case the password is forgotten. I'm looking for a legitimate way to change where the old pass as well as new pass needs to be provided and the old pass will be validated before the new pass is set.

推荐答案

有没有必要再次登录的用户,只需在用户运行has​​Password方法比较密码,如果属实,更新属性。

There is no need to log the user in again, simply run the hasPassword method on the User to compare the passwords and if true, update the attribute

这样的事情...

    如果(user.hasPassword(req.body.oldPassword)){
        user.updateAttribute('密码',req.body.password ....
    }

https://apidocs.strongloop.com/loopback/#user-prototype- haspassword

这篇关于什么是角Strongloop应用更改密码的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆