JioCloud/horizon — pull request #7 by vivekdhayaal (2014-08-04 13:05:57+00:00)
Title: Recovery mechanisms for users

* Option for a user to recover password
* Option to recover activation link
* Option to recover OTP SMS message

Workflow:
1)Click 'Forgot Password' button
2)Enter your email id(forgot password page) and submit
3)Behind the scenes, a OTP is generated and stored in db and a link is
constructed using that OTP and mailed to user.
4)Click the link sent to your email
5)Enter new password(reset password page) and submit

P.S. - Recover activation link and recover OTP SMS message options are
provided by 'Resend Email' and 'Resend OTP' links in user registration
response page and account activation page respectively.

File changes:
* horizon/templates/auth/_login.html
+ Added link to 'Forgot Password'

* horizon_jiocloud/signup/urls.py
+ Added urls for 'Resend Email' and 'Resend OTP' options
and 'Forgot Password' and 'Reset Password' pages.

* horizon_jiocloud/signup/views.py
* horizon_jiocloud/signup/forms.py
* horizon_jiocloud/templates/signup/signup_success.html
* horizon_jiocloud/templates/signup/sms_activation.html
* horizon_jiocloud/templates/signup/forgot_password.html
* horizon_jiocloud/templates/signup/forgot_password_success.html
* horizon_jiocloud/templates/signup/password_change_verification.html
* horizon_jiocloud/templates/signup/reset_password.html
* horizon_jiocloud/templates/signup/reset_password_success.html
+ Replaced multiple instances of similar code with newer utility methods
+ New methods 'resendSms' & 'resendEmail' to cater to the corresponding
options to users.
Finer nuances:
1)Removed the code that invalidates the 'account activation' page
if the OTP had expired because we provide an option for users to
recover their OTP in that page.
2)Flag 'resentSms' used to indicate that we are rendering the account
activation page after having resent the SMS. This would help us reuse
the same template for initial loading of 'account activation' page and
the subsequent loading with a message after having resent the SMS.
3)Flag 'resentSuccess' used to indicate that the SMS was resent
successfully so that the corresponding message is displayed to user.
4)Flags 'resentEmail' and 'resentSuccess' are used to serve the above
said purpose for 'resend email' option.
+ New class based views 'UserForgotPasswordView' and
'UserResetPasswordView', the associated form classes
'UserForgotPasswordForm' and 'UserResetPasswordForm', the corresponding
templates 'forgot_password.html', 'forgot_password_success.html',
'password_change_verification.html', 'reset_password.html',
'reset_password_success.html' to cater to the
forgot-password and reset-password pages

* horizon_jiocloud/utils/utils.py
+ Refactored the frequently used code as new utility methods
'generate_sms_activation_code', 'generate_and_send_sms' and
'send_registration_email'

* horizon_jiocloud/change_phone/views.py
* horizon_jiocloud/change_phone/forms.py
+ Used the newer utility methods

Fixes bug #1324074
Fixes bug #1324073

Implements: blueprint forgot-password-jio-dashboard