(self, form)
| 225 | return super(RequireEmailView, self).get_context_data(**kwargs) |
| 226 | |
| 227 | def form_valid(self, form): |
| 228 | email = form.cleaned_data['email'] |
| 229 | oauthid = form.cleaned_data['oauthid'] |
| 230 | oauthuser = get_object_or_404(OAuthUser, pk=oauthid) |
| 231 | oauthuser.email = email |
| 232 | oauthuser.save() |
| 233 | sign = get_sha256(settings.SECRET_KEY + |
| 234 | str(oauthuser.id) + settings.SECRET_KEY) |
| 235 | site = get_current_site().domain |
| 236 | if settings.DEBUG: |
| 237 | site = '127.0.0.1:8000' |
| 238 | path = reverse('oauth:email_confirm', kwargs={ |
| 239 | 'id': oauthid, |
| 240 | 'sign': sign |
| 241 | }) |
| 242 | url = "http://{site}{path}".format(site=site, path=path) |
| 243 | |
| 244 | content = _(""" |
| 245 | <p>Please click the link below to bind your email</p> |
| 246 | |
| 247 | <a href="%(url)s" rel="bookmark">%(url)s</a> |
| 248 | |
| 249 | Thank you again! |
| 250 | <br /> |
| 251 | If the link above cannot be opened, please copy this link to your browser. |
| 252 | <br /> |
| 253 | %(url)s |
| 254 | """) % {'url': url} |
| 255 | send_email(emailto=[email, ], title=_('Bind your email'), content=content) |
| 256 | url = reverse('oauth:bindsuccess', kwargs={ |
| 257 | 'oauthid': oauthid |
| 258 | }) |
| 259 | url = url + '?type=email' |
| 260 | return HttpResponseRedirect(url) |
| 261 | |
| 262 | |
| 263 | def bindsuccess(request, oauthid): |
nothing calls this directly
no test coverage detected