Welcome Guest Search | Active Topics | Members | Log In | Register

Registering an Account Options · View
speenr
Posted: Sunday, March 14, 2010 3:02:47 PM
Rank: Newbie
Groups: Member

Joined: 2/28/2009
Posts: 6
Points: 18
Location: NY
Move the permission "REGISTERED" to the VerifyEmail page.

You should move the "Permission registeredPermission = _permissionRepository.GetPermissionByName("REGISTERED");" line from the Register Account page to the EmailVerified page since an Account really isn't "REGISTERED" until they verify their email address. This way a "PUBLIC" Account will not have access to the "REGISTERED" pages until they verify their email address.


private IWebContext _webContext;
private IAccountRepository _accountRepository;

private IPermissionRepository _permissionRepository;

public void Init(IVerifyEmail _view)
{
_webContext = ObjectFactory.GetInstance<IWebContext>();
_accountRepository = ObjectFactory.GetInstance<IAccountRepository>();

_permissionRepository = ObjectFactory.GetInstance<IPermissionRepository>();

string userName = Cryptography.Decrypt(_webContext.UserNameToVerify, "verify");

Account account = _accountRepository.GetAccountByUserName(userName);

Permission registeredPermission = _permissionRepository.GetPermissionByName("REGISTERED");

if (account != null)
{
account.EmailVerified = true;

_accountRepository.AddPermission(account, registeredPermission);

_accountRepository.SaveAccount(account);

Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.
This page was generated in 0.356 seconds.