annotate rhodecode/controllers/login.py @ 564:ba7e24cd4786

refactor codes and setup for python 2.5 readme update
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 09 Oct 2010 16:05:14 +0200
parents f99075170eb4
children 7e536d1af60d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
252
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
1 #!/usr/bin/env python
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
2 # encoding: utf-8
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
3 # login controller for pylons
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
360
db187729c40c new style error display for login
Marcin Kuzminski <marcin@python-works.com>
parents: 252
diff changeset
5 #
252
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
6 # This program is free software; you can redistribute it and/or
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
7 # modify it under the terms of the GNU General Public License
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
8 # as published by the Free Software Foundation; version 2
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
9 # of the License or (at your opinion) any later version of the license.
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
10 #
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
11 # This program is distributed in the hope that it will be useful,
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
14 # GNU General Public License for more details.
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
15 #
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
16 # You should have received a copy of the GNU General Public License
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
17 # along with this program; if not, write to the Free Software
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
3782a6d698af licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 202
diff changeset
19 # MA 02110-1301, USA.
417
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
20
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
21 """
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
22 Created on April 22, 2010
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
23 login controller for pylons
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
24 @author: marcink
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
25 """
363
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
26 from formencode import htmlfill
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
27 from pylons import request, response, session, tmpl_context as c, url
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
28 from pylons.controllers.util import abort, redirect
547
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
29 from rhodecode.lib.auth import AuthUser, HasPermissionAnyDecorator
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
30 from rhodecode.lib.base import BaseController, render
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
31 import rhodecode.lib.helpers as h
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
32 from pylons.i18n.translation import _
547
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
33 from rhodecode.model.forms import LoginForm, RegisterForm, PasswordResetForm
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
34 from rhodecode.model.user_model import UserModel
363
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
35 import formencode
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
36 import logging
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
38 log = logging.getLogger(__name__)
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
39
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
40 class LoginController(BaseController):
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
41
202
3fd2af1ba5ea updated logging in logout. Added before, on login page.
Marcin Kuzminski <marcin@python-works.com>
parents: 195
diff changeset
42 def __before__(self):
3fd2af1ba5ea updated logging in logout. Added before, on login page.
Marcin Kuzminski <marcin@python-works.com>
parents: 195
diff changeset
43 super(LoginController, self).__before__()
3fd2af1ba5ea updated logging in logout. Added before, on login page.
Marcin Kuzminski <marcin@python-works.com>
parents: 195
diff changeset
44
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
45 def index(self):
195
7109d15c6813 cleared prints leftoovers, and changed current user fetching in login controller
Marcin Kuzminski <marcin@python-works.com>
parents: 186
diff changeset
46 #redirect if already logged in
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
47 c.came_from = request.GET.get('came_from', None)
437
930f8182a884 Added redirection to page that request came from, after login in
Marcin Kuzminski <marcin@python-works.com>
parents: 424
diff changeset
48
548
b75b77ef649d renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
49 if c.rhodecode_user.is_authenticated:
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
50 return redirect(url('hg_home'))
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
51
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
52 if request.POST:
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
53 #import Login Form validator class
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
54 login_form = LoginForm()
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
55 try:
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
56 c.form_result = login_form.to_python(dict(request.POST))
442
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
57 username = c.form_result['username']
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
58 user = UserModel().get_user_by_name(username)
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
59 auth_user = AuthUser()
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
60 auth_user.username = user.username
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
61 auth_user.is_authenticated = True
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
62 auth_user.is_admin = user.admin
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
63 auth_user.user_id = user.user_id
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
64 auth_user.name = user.name
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
65 auth_user.lastname = user.lastname
548
b75b77ef649d renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
66 session['rhodecode_user'] = auth_user
442
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
67 session.save()
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
68 log.info('user %s is now authenticated', username)
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
69
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
70 user.update_lastlogin()
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
71
437
930f8182a884 Added redirection to page that request came from, after login in
Marcin Kuzminski <marcin@python-works.com>
parents: 424
diff changeset
72 if c.came_from:
930f8182a884 Added redirection to page that request came from, after login in
Marcin Kuzminski <marcin@python-works.com>
parents: 424
diff changeset
73 return redirect(c.came_from)
930f8182a884 Added redirection to page that request came from, after login in
Marcin Kuzminski <marcin@python-works.com>
parents: 424
diff changeset
74 else:
930f8182a884 Added redirection to page that request came from, after login in
Marcin Kuzminski <marcin@python-works.com>
parents: 424
diff changeset
75 return redirect(url('hg_home'))
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
76
564
ba7e24cd4786 refactor codes and setup for python 2.5
Marcin Kuzminski <marcin@python-works.com>
parents: 549
diff changeset
77 except formencode.Invalid, errors:
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
78 return htmlfill.render(
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
79 render('/login.html'),
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
80 defaults=errors.value,
360
db187729c40c new style error display for login
Marcin Kuzminski <marcin@python-works.com>
parents: 252
diff changeset
81 errors=errors.error_dict or {},
db187729c40c new style error display for login
Marcin Kuzminski <marcin@python-works.com>
parents: 252
diff changeset
82 prefix_error=False,
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
83 encoding="UTF-8")
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
84
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
85 return render('/login.html')
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
86
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
87 @HasPermissionAnyDecorator('hg.admin', 'hg.register.auto_activate',
442
d66a7fa7689b moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents: 437
diff changeset
88 'hg.register.manual_activate')
363
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
89 def register(self):
417
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
90 user_model = UserModel()
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
91 c.auto_active = False
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
92 for perm in user_model.get_default().user_perms:
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
93 if perm.permission.permission_name == 'hg.register.auto_activate':
418
63c697d1a631 added logic for changin defualt permissions, and option to overwrite all defualt permissions on each repository
Marcin Kuzminski <marcin@python-works.com>
parents: 417
diff changeset
94 c.auto_active = True
417
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
95 break
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
96
363
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
97 if request.POST:
417
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
98
363
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
99 register_form = RegisterForm()()
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
100 try:
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
101 form_result = register_form.to_python(dict(request.POST))
417
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 363
diff changeset
102 form_result['active'] = c.auto_active
363
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
103 user_model.create_registration(form_result)
549
f99075170eb4 more renames for rhode code !!
Marcin Kuzminski <marcin@python-works.com>
parents: 548
diff changeset
104 h.flash(_('You have successfully registered into rhodecode'),
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
105 category='success')
363
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
106 return redirect(url('login_home'))
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
107
564
ba7e24cd4786 refactor codes and setup for python 2.5
Marcin Kuzminski <marcin@python-works.com>
parents: 549
diff changeset
108 except formencode.Invalid, errors:
363
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
109 return htmlfill.render(
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
110 render('/register.html'),
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
111 defaults=errors.value,
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
112 errors=errors.error_dict or {},
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
113 prefix_error=False,
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
114 encoding="UTF-8")
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
115
98abf8953b87 Added user registration, changed login url schema, moved it into _admin/ for safety
Marcin Kuzminski <marcin@python-works.com>
parents: 360
diff changeset
116 return render('/register.html')
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
117
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
118 def password_reset(self):
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
119 user_model = UserModel()
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
120 if request.POST:
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
121
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
122 password_reset_form = PasswordResetForm()()
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
123 try:
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
124 form_result = password_reset_form.to_python(dict(request.POST))
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
125 user_model.reset_password(form_result)
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
126 h.flash(_('Your new password was sent'),
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
127 category='success')
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
128 return redirect(url('login_home'))
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
129
564
ba7e24cd4786 refactor codes and setup for python 2.5
Marcin Kuzminski <marcin@python-works.com>
parents: 549
diff changeset
130 except formencode.Invalid, errors:
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
131 return htmlfill.render(
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
132 render('/password_reset.html'),
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
133 defaults=errors.value,
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
134 errors=errors.error_dict or {},
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
135 prefix_error=False,
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
136 encoding="UTF-8")
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
137
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
138 return render('/password_reset.html')
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
139
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
140 def logout(self):
548
b75b77ef649d renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
141 session['rhodecode_user'] = AuthUser()
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
142 session.save()
202
3fd2af1ba5ea updated logging in logout. Added before, on login page.
Marcin Kuzminski <marcin@python-works.com>
parents: 195
diff changeset
143 log.info('Logging out and setting user as Empty')
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
144 redirect(url('hg_home'))