|
a/opensourceprojects/controllers.py |
|
b/opensourceprojects/controllers.py |
|
... |
|
... |
59 |
raise formencode.Invalid('That email address is already taken. Please choose another.',
|
59 |
raise formencode.Invalid('That email address is already taken. Please choose another.',
|
60 |
value, state)
|
60 |
value, state)
|
61 |
|
61 |
|
62 |
return d
|
62 |
return d
|
63 |
|
63 |
|
64 |
form = OSPRegistrationForm(action='/auth2/save_new', submit_text='Sign Up')
|
64 |
form = OSPRegistrationForm(action='/auth/save_new', submit_text='Sign Up')
|
65 |
|
65 |
|
66 |
class OSPAuthController(AuthController):
|
66 |
class OSPAuthController(AuthController):
|
67 |
"""
|
67 |
"""
|
68 |
This Auth controller modifies account registration
|
68 |
This Auth controller modifies account registration
|
69 |
"""
|
69 |
"""
|
|
... |
|
... |
107 |
|
107 |
|
108 |
%s
|
108 |
%s
|
109 |
|
109 |
|
110 |
If you did not request this account, please ignore this email.
|
110 |
If you did not request this account, please ignore this email.
|
111 |
|
111 |
|
112 |
''' % (email.claimed_by_user().username, g.url('/auth2/verify_acct', a=email.nonce), passwd)
|
112 |
''' % (email.claimed_by_user().username, g.url('/auth/verify_acct', a=email.nonce), passwd)
|
113 |
|
113 |
|
114 |
allura.tasks.mail_tasks.sendmail.post(
|
114 |
allura.tasks.mail_tasks.sendmail.post(
|
115 |
destinations=[email._id],
|
115 |
destinations=[email._id],
|
116 |
fromaddr=email._id,
|
116 |
fromaddr=email._id,
|
117 |
reply_to='',
|
117 |
reply_to='',
|
118 |
subject='OpensourceProjects.eu: Account creation',
|
118 |
subject='OpensourceProjects.eu: Account creation',
|
119 |
message_id=h.gen_message_id(),
|
119 |
message_id=h.gen_message_id(),
|
120 |
text=text)
|
120 |
text=text)
|
121 |
|
121 |
|
122 |
@expose('jinja:opensourceprojects:templates/verify_acct.html')
|
122 |
@expose()
|
123 |
def verify_acct(self, a):
|
123 |
def verify_acct(self, a):
|
124 |
"""
|
124 |
"""
|
125 |
Verify an account using an email token
|
125 |
Verify an account using an email token
|
126 |
"""
|
126 |
"""
|
127 |
addr = M.EmailAddress.query.get(nonce=a)
|
127 |
addr = M.EmailAddress.query.get(nonce=a)
|
128 |
if not addr:
|
128 |
if not addr:
|
129 |
flash('Unknown verification link', 'error')
|
129 |
flash('Unknown verification link', 'error')
|
130 |
redirect('/')
|
130 |
redirect('/')
|
131 |
|
131 |
|
132 |
addr.confirmed = True
|
132 |
addr.confirmed = True
|
|
|
133 |
addr.nonce = ''
|
133 |
user = addr.claimed_by_user()
|
134 |
user = addr.claimed_by_user()
|
134 |
user.disabled = False
|
135 |
user.disabled = False
|
135 |
return dict(username=user.username)
|
136 |
flash('User "%s" confirmed, you can now login into your account' % user.username)
|
|
|
137 |
redirect('/')
|
136 |
|
138 |
|
137 |
@staticmethod
|
139 |
@staticmethod
|
138 |
def random_pass(size=8, chars=string.ascii_letters + string.digits):
|
140 |
def random_pass(size=8, chars=string.ascii_letters + string.digits):
|
139 |
"""
|
141 |
"""
|
140 |
Generate a random password
|
142 |
Generate a random password
|
|
... |
|
... |
157 |
* An about page
|
159 |
* An about page
|
158 |
* A new auth controller
|
160 |
* A new auth controller
|
159 |
* A new front page
|
161 |
* A new front page
|
160 |
"""
|
162 |
"""
|
161 |
|
163 |
|
162 |
# auth = OSPAuthController()
|
164 |
auth = OSPAuthController()
|
163 |
auth2 = OSPAuthController()
|
|
|
164 |
|
165 |
|
165 |
@expose('jinja:opensourceprojects:templates/about.html')
|
166 |
@expose('jinja:opensourceprojects:templates/about.html')
|
166 |
def about(self):
|
167 |
def about(self):
|
167 |
return dict()
|
168 |
return dict()
|
168 |
|
169 |
|
169 |
@expose('jinja:opensourceprojects:templates/frontpage.html')
|
170 |
@expose('jinja:opensourceprojects:templates/frontpage.html')
|
170 |
@with_trailing_slash
|
171 |
@with_trailing_slash
|
171 |
def index(self, **kw):
|
172 |
def index(self, **kw):
|
172 |
return dict(form=OSPRegistrationForm(submit_text='Sign Up now!', action='/auth2/save_new'))
|
173 |
return dict(form=OSPRegistrationForm(submit_text='Sign Up now!', action='/auth/save_new'))
|
173 |
|
174 |
|
174 |
|
175 |
|
175 |
|
176 |
|