-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Registration & Reset password #68
Open
ordavidil
wants to merge
46
commits into
Gizra:master
Choose a base branch
from
ordavidil:reset-password
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
52a306a
Merge pull request #1 from ordavidil/update-gitignore
ordavidil bce2ec0
Adding "Reset Password" message.
d8be92d
Adding "Reset Password" endpoint.
feb0c2d
Adding "Forgot Password" flow on the client.
7236eb4
Adding "Save new password" flow to the client.
309cb12
WIP - Adding an endpoint to update a user entity.
8da77cf
Changing resource name to prevent a clash with the 'users' resource.
70595ce
WIP - Adding sign up page.
2f3c7eb
WIP - Adding email availability endpoint.
70b62d9
WIP - Adding username availability endpoint.
701a538
Adding "Verify Email" message.
ed95f95
Fixing email & username availability endpoints
c081b8c
Adding the option of creating new user through endpoint.
40ce87c
Adding the "sign up" function to the client.
48f8f68
Resetting the flags before each request.
285b6e9
Adding email verification mechanism.
3673dcc
Prevent from drupal to notify users about activated account.
a03bfa0
Changing to camelCase.
70b5b56
Improved the error msg.
cb081e4
Adding a setter for the access token.
6a38f14
Adding comment.
a5d061c
Removing unnecessary variable.
3a094b9
Cleanup files.
7174bd6
Adding RESTful empty response.
bf0b5f8
Fixing err msgs on "Forgot Password" page.
fe3cf58
Deny access to password field on GET request.
9337802
Adding "Users Availability".
942507a
Sending verification mail via "hook_user_insert".
e811c6d
Changing back the class to extend from.
d52578c
Removing "SkeletonTokenNotifierResource" class.
245e436
Checking the site settings before sending a verification mail.
21dc4a7
Checking the site settings before allowing a user to register.
90a7201
Removing unnecessary name/mail setters.
1afa24f
Cleanup.
b51a293
Cleanup.
b3af456
Cleanup.
a5883a1
Verify the email on the state resolve.
ae513bc
Cleaning up the "Reset Password" controller.
159671d
Fixing .travis.tml
237c8a7
Fixing .travis.yml round #2
2377d6f
Fixing .travis.yml round #3
b2804c1
Updating angular version.
32ea7af
Fixing .travis.yml round #4
d4969d7
Fixing travis.yml round #5
d9c2023
Update angular minor version.
5292ce9
Fixing travis.yml round #6
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/templates/client/app/scripts/controllers/forgot-password.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc function | ||
* @name clientApp.controller:ForgotPasswordCtrl | ||
* @description | ||
* # ForgotPasswordCtrl | ||
* Controller of the clientApp | ||
*/ | ||
angular.module('clientApp') | ||
.controller('ForgotPasswordCtrl', function ($scope, Auth) { | ||
|
||
/** | ||
* Send a password reset link. | ||
*/ | ||
$scope.forgotPassword = function() { | ||
// Reset the error message for each request. | ||
$scope.ErrorMsg = false; | ||
|
||
Auth.resetPassword($scope.email).then(function () { | ||
$scope.passwordResetSent = true; | ||
}, | ||
function(response) { | ||
$scope.ErrorMsg = response.data.title; | ||
|
||
// Too many requests. | ||
if (response.status == 429) { | ||
$scope.ErrorMsg = response.statusText; | ||
$scope.TooManyRequests = true; | ||
} | ||
}); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
app/templates/client/app/scripts/controllers/reset-password.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc function | ||
* @name clientApp.controller:ResetPasswordCtrl | ||
* @description | ||
* # ResetPasswordCtrl | ||
* Controller of the clientApp | ||
*/ | ||
angular.module('clientApp') | ||
.controller('ResetPasswordCtrl', function ($scope, Auth, Account) { | ||
|
||
// Determine if password was reset successfully. | ||
$scope.passwordSaved = false; | ||
|
||
/** | ||
* Setting the access token in the localStorage so we can get the account | ||
* information and pull out the user ID from it to PATCH the user entity. | ||
* | ||
* @param password | ||
* The new password. | ||
*/ | ||
$scope.saveNewPassword = function(password) { | ||
Account.get().then(function(user) { | ||
Auth.savePassword(user.id, password).then(function() { | ||
$scope.passwordSaved = true; | ||
}); | ||
}); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc function | ||
* @name clientApp.controller:SignUpCtrl | ||
* @description | ||
* # SignUpCtrl | ||
* Controller of the clientApp | ||
*/ | ||
angular.module('clientApp') | ||
.controller('SignUpCtrl', function ($scope, Auth) { | ||
|
||
// Reset the flags. | ||
$scope.emailAvailable = true; | ||
$scope.usernameAvailable = true; | ||
|
||
/** | ||
* Send a password reset link. | ||
*/ | ||
$scope.signUp = function(user) { | ||
// Clear the error before each request. | ||
$scope.signupError = undefined; | ||
|
||
Auth.usersAvailability(user).then(function(response) { | ||
$scope.usernameAvailable = response.data.data.available.name; | ||
$scope.emailAvailable = response.data.data.available.mail; | ||
|
||
if ($scope.emailAvailable && $scope.usernameAvailable) { | ||
Auth.signUp(user).then(function() { | ||
// User registered successfully. | ||
$scope.signedUp = true; | ||
}, function (response) { | ||
// Error trying to register the user. | ||
$scope.signupError = response.data.detail; | ||
}); | ||
} | ||
}); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,7 @@ | |
min-height: 500px; | ||
} | ||
|
||
.vertical-space { | ||
margin-top: 15px; | ||
margin-bottom: 15px; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Determine if password was reset successfully.