Ruby on rails 如何在ng token auth中请求重置后调用更新密码并设计token auth?
我使用的是rails api和Angular Front。我在忘记密码?中遇到问题 我希望在成功忘记密码请求后,允许用户登录并重定向到我的更新密码路径以更改密码。 结果是用户登录,但重定向url不会转到更新密码路径。 我的重定向url变为从:到 请注意,Ruby on rails 如何在ng token auth中请求重置后调用更新密码并设计token auth?,ruby-on-rails,angularjs,authentication,devise,Ruby On Rails,Angularjs,Authentication,Devise,我使用的是rails api和Angular Front。我在忘记密码?中遇到问题 我希望在成功忘记密码请求后,允许用户登录并重定向到我的更新密码路径以更改密码。 结果是用户登录,但重定向url不会转到更新密码路径。 我的重定向url变为从:到 请注意,#/auth/update_password转到链接的末尾 我的ng路线如下所示: mainApp.config(function ($routeProvider) { $routeProvider .when('/', {
#/auth/update_password
转到链接的末尾
我的ng路线如下所示:
mainApp.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/pages/Home.html',
controller: 'HomeCtrl'
})
.when('/auth/signup', {
templateUrl: 'views/auth/signup.html',
controller: 'authCtrl'
})
.when('/auth/signin', {
templateUrl: 'views/auth/signin.html',
controller: 'authCtrl'
})
.when('/auth/request_reset',{
templateUrl: 'views/auth/requestResetPassword.html',
controller: 'authCtrl'
})
.when('/auth/update_password',{
templateUrl: 'view/auth/updatePassword.html',
controller: 'authCtrl'
})
.otherwise({
redirectTo: '/'
});
});
我的ng令牌身份验证设置是:
mainApp.constant('railsServer', 'http://localhost:3000/api/v1');
mainApp.constant('angServer', 'http://localhost:9000/#');
mainApp.config(function ($authProvider, angServer, railsServer) {
$authProvider.configure({
apiUrl: railsServer,
storage: 'localStorage',
confirmationSuccessUrl: 'http://localhost:9000/#/auth/update_password',
passwordResetSuccessUrl: 'http://localhost:9000/#/auth/update_password'
});
});
我的authCtrl是:
var authApp = angular.module('authModule', []);
authApp.controller('authCtrl', ['$scope', '$auth', '$http', '$location', 'railsServer', '$log', function ($scope, $auth, $http, $location, railsServer, $log) {
$scope.go = function (path) {
$location.path(path);
};
var rails_server_path = railsServer;
$scope.userSignUp = function (userSignUpForm) {
$auth.submitRegistration(userSignUpForm)
.then(function (resp) {
$log.info("Welcome " + resp.data.data.email + " !");
})
.catch(function (resp) {
$log.error(resp.data.errors.full_messages[0]);
});
};
$scope.userSignIn = function (userSignInForm) {
$auth.submitLogin(userSignInForm)
.then(function (resp) {
$log.info("Welcome " + resp.email + " !");
$location.path('/#/')
})
.catch(function (resp) {
$log.error(resp.errors[0]);
});
};
$scope.userRequestReset = function(userRequestResetForm){
$auth.requestPasswordReset(userRequestResetForm)
.then(function(resp){
$log.info(resp);
})
.catch(function(resp){
$log.error(resp);
});
};
$scope.userUpdatePassword = function(userUpdatePasswordForm){
$auth.updatePassword(userUpdatePasswordForm)
.then(function(resp){
$log.info(resp);
})
.catch(function(resp){
$log.error(resp.data.errors[0]);
});
};
}]);
我的设计令牌身份验证设置是默认设置