我的APS.NET应用程序中有一个带有AnonymousTemplate和LoggedInTemplate的LoginView.我已将LogStatus控件放在LoggedInTemplate中,但它不能按预期工作.
这是代码
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
<asp:Login ID="Login1" runat="server" OnAuthenticate="Login1_Authenticate"
DisplayRememberMe="False" PasswordRecoveryUrl="/"
DestinationPageUrl="/">
</asp:Login>
</AnonymousTemplate>
<LoggedInTemplate>
You are logged in as
<asp:LoginName ID="LoginName1" runat="Server"></asp:LoginName>.
<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="Redirect"
LogoutPageUrl="/" onloggingout="LoginStatus1_LoggingOut" />
</LoggedInTemplate>
</asp:LoginView>
Run Code Online (Sandbox Code Playgroud)
所有事件处理程序都在代码隐藏文件中正确定义.
问题是,如果用户登录,他将从LoginStatus控件中看到带有注销链接的用户名.单击注销链接会将用户返回到登录表单(登录和注销表单都是同一用户控件的一部分)但如果我刷新页面,则用户仍然会登录.
我注意到如果我在LoginView之外移动LoginStatus控件,那么注销过程将按预期工作.我还注意到,当LoginStatus在LoginView中时,它不会引发注销事件.
有没有人有任何想法可能是什么问题?
我有一个带登录视图的母版页,在loginview中我有一个asp登录控件.我还有一个不包含在loginview中的标签.
如何访问asp登录控件中的用户名文本框控件并在标签中显示文本.
请帮忙!
这是我的代码:
Login lg = (Login)LoginView1.FindControl("Login1");
TextBox tb = (TextBox)lg.FindControl("UserName");
Label2.Text = tb.Text;
Run Code Online (Sandbox Code Playgroud)
好的,这就是我需要做的事:投诉人可以停用他的帐户.管理员和技术人员帐户已停用,如有必要,也会由管理员重新激活.投诉人可以随时重新启动他的帐户.
我需要验证在文本框中输入的用户名,以首先检查它是否是活动用户.如果没有,它允许他们重新激活它.如何从用户名文本框中访问文本.其余我可以搞清楚.
在表单的PageLoad事件中,我无法在登录模板中引用服务器端控件.我错过了什么 因此,当我登录时,我将显示文本框控件,否则我将显示"请登录做soso ..."之类的文字.
请帮忙 ..
我试图在 LoginView LoggedIn 模板中获取 LoginName 控件,尽管有几种方法,但代码仍然无法工作。
我希望将默认用户名更改为客户名称。
这是代码:
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
Hello, <asp:LoginName ID="LoginName1" runat="server"></asp:LoginName>
<br />
<div style="text-align: right; margin-right: 5px ">
<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutPageUrl="~/Home.aspx" Font-Underline="True" />
</div></div>
</LoggedInTemplate>
</asp:LoginView>
Run Code Online (Sandbox Code Playgroud)
在后面的代码:
protected void Login1_LoggedIn(object sender, EventArgs e)
{
LoginName loginName = LoginView1.FindControl("LoginName1") as LoginName;
Response.Write(loginName.ToString()); //for now I used Response.Write for testing purposes
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试扩展MacOSX 10.9.1(Mavericks)中的登录界面.正如我所知,这可以通过实现一个新的身份验证插件并将其安装到授权数据库中来实现.
我已经下载了NameAndPassword示例,该示例演示了如何实现接口并覆盖/扩展SFAuthorizationPluginView.但问题是我无法在小牛队的基础上建立它.所以我决定下载第二个名为NullAuthPlugin的例子.这个编译,但我没有找到如何安装它.
所以我的问题是,如果有一个好的和更新的教程(TechNotes是形式2008-09-16)?
第二个问题是,如果可以用C#(Xamarin.Mac/MonoMac)开发,因为我不是很擅长开发Objective-C/C/C++.
谢谢!
我有一个基于类的视图,即子类LoginView.
from django.contrib.auth.views import LoginView
class CustomLoginView(LoginView):
def get_success_url(self):
url = self.get_redirect_url()
return url or reverse_lazy('knowledgebase:user_home', kwargs={
'username':self.request.user.username,
})
Run Code Online (Sandbox Code Playgroud)
如果用户的电子邮件尚未激活,我想覆盖错误消息,因为他们必须单击发送到其电子邮件地址的链接。当前的默认消息如下所示:
而不是说:
请输入正确的电子邮件地址和密码。两个地方都要注意大小写。
我想说一句话,大意是:
请确认您的电子邮件,以便您可以登录。
我试过:
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import gettext as _
class PickyAuthenticationForm(AuthenticationForm):
def confirm_login_allowed(self, user):
if not user.is_active:
raise forms.ValidationError(
_("Please confirm your email so you can log in."),
code='inactive',
)
Run Code Online (Sandbox Code Playgroud)
class CustomLoginView(LoginView): # 1. <--- note: this is a class-based view
form_class = PickyAuthenticationForm # 2. <--- note: define form …Run Code Online (Sandbox Code Playgroud) 我在使用LoginView时遇到了问题.有人可以告诉我是否可以在LoginView(以及如何)中执行此操作,或者是否需要使用代码隐藏.
我有两个角色 - 管理员和用户.我想根据角色动态显示链接.我会在if语句中写出我想要的东西,因为它更容易解释:
if (role = Administrator) //Display only if administrator.
Show Hyperlink 1
Show Hyperlink 2
else
if (role = User) //Display only if user.
Show Hyperlink 3
Show Hyperlink 4
endif
//Display these if a user or if non-authenticated user...
Show Hyperlink 5
Show Hyperlink 6
Show Hyperlink 7
endif
Run Code Online (Sandbox Code Playgroud) 我目前正在开发一个iOS应用程序,允许用户查阅他们的帐户(在网站上创建帐户).
我希望用户可以在连接后查阅他的帐户.所以,我想要一个第一个视图,它将是一个登录视图.接受连接后,登录视图消失,第一个视图控制器加载数据.
我怎样才能做到这一点?
在单击fbloginview时允许用户的读取权限后,下面的代码尝试重新授权发布权限.
#pragma mark FBLoginViewDelegate Method
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user {
NSLog(@"User info fetched %@ %@", user.name, user.id);
[Global FBUser:user.first_name lastname:user.last_name fid:user.id];
if ([[FBSession activeSession] isOpen])
{
//[[FBSession activeSession] closeAndClearTokenInformation];
[[FBSession activeSession] reauthorizeWithPublishPermissions:[[[NSArray alloc] initWithObjects:@"publish_stream", nil] autorelease]
defaultAudience:FBSessionDefaultAudienceEveryone
completionHandler:^(FBSession* session, NSError* error)
{
if ([delegate respondsToSelector:@selector(SignUpAlertViewWasDone:)])
[delegate SignUpAlertViewWasDone:self];
[self removeFromSuperview];
}
];
}
Run Code Online (Sandbox Code Playgroud)
它给了我这个错误:
exception'com.facebook.sdk:InvalidOperationException',reason:'FBSession:在先前的重新授权呼叫尚未完成时重新授权无效.'
以前的重新授权呼叫完成时是否有可以检测到的功能?
我尝试使用openWithPublishPermission但它不起作用.
我有一个带有onloggedin事件处理程序的.Net登录控件.
onloggedin="Login2_LoggedIn"
Run Code Online (Sandbox Code Playgroud)
但User.Identity始终为null.
protected void Login2_LoggedIn(object sender, EventArgs e)
{
// Is User is Admin
if (Roles.IsUserInRole(User.Identity.Name, "admin"))
Run Code Online (Sandbox Code Playgroud)
它应该在此时可用吗? 或者我应该从对象发送者或EventArgs e获取用户名?
我在我的iPad应用程序上使用splitViewController,但在此之前,我有一个登录,并在成功验证后刷新根和详细信息视图.问题是,一旦我加载主视图没有任何反应,我尝试推送任何视图,没有事件.
当我以模态方式加载Login视图时,我收到此错误:"不平衡调用开始/结束外观转换为
我使用以下命令在主视图(frontViewController)中执行登录视图:
-(void)displayLoginView:(BOOL)animated{
LoginView *loginController = [[LoginView alloc] initWithNibName:@"LoginView" bundle:nil];
[self presentModalViewController:loginController animated:YES];
Run Code Online (Sandbox Code Playgroud)
}
- (void)viewDidLoad{
[super viewDidLoad];
//Add logout button
Run Code Online (Sandbox Code Playgroud)
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Logout"style:UIBarButtonItemStyleBordered target:self action:@selector(logout)]; //如果尚未登录,则显示登录视图[self displayLoginView:NO]; }
-(void)logout{
[self displayLoginView:YES];
Run Code Online (Sandbox Code Playgroud)
}
和appdelegate.m:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
FrontViewController *frontViewController;
RearViewController *rearViewController;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
frontViewController = [[FrontViewController alloc] initWithNibName:@"FrontViewController_iPhone" bundle:nil];
rearViewController = [[RearViewController alloc] initWithNibName:@"RearViewController_iPhone" bundle:nil];
}
else{
frontViewController = [[FrontViewController alloc] initWithNibName:@"FrontViewController_iPad" bundle:nil];
rearViewController …Run Code Online (Sandbox Code Playgroud)