我正在尝试创建一个网站,人们只会将他们的电子邮件地址和他们用cookie和所有人登录.在稍后阶段,我会要求他们提供密码和名称,但不会使用用户名.我试图用django-registraition做这个,但我得到错误,我有一些问题.
首先禁用用户名作为登录功能,我把str(time())而不是用户名 - 我正在寻找每次都会改变的东西.
但是,当我跳过身份验证(我目前不需要)时,我收到错误:
'RegistrationProfile' object has no attribute 'backend'
Run Code Online (Sandbox Code Playgroud)
或者,我可以离开身份验证,但后来我不知道如何只通过电子邮件和密码验证它.另外,我不知道如何使下一行工作:
auth.login(request, ProfileUser)
Run Code Online (Sandbox Code Playgroud)
如果有人能让我离开这里,那将是非常棒的.这是一些代码:
我的表格类:
class RegistrationFormCustom(forms.Form):
email = forms.EmailField()
def do_save(self):
new_u = User(username=str(time()),email= self.cleaned_data.get('email'),)
new_u.save()
new_p = Profile.objects.create_profile(new_u)
new_p.save()
return new_p
Run Code Online (Sandbox Code Playgroud)
我的看法:
def registerCustom(request, backend, success_url=None, form_class=None,
disallowed_url='registration_disallowed',
template_name='registration/registration_form.html',
extra_context=None,
initial={}):
form = RegistrationFormCustom(initial=initial)
if request.method == 'POST':
form = RegistrationFormCustom(initial=initial, data=request.POST)
if form.is_valid():
profile = form.do_save()
profile = auth.authenticate(username = profile.user.email, password = form.cleaned_data.get('pass1'))
print(profile)
auth.login(request, profile)
return redirect('/')
else:
pass
return render_jinja(request, 'registration/registration_form.html',
type="register",
form …Run Code Online (Sandbox Code Playgroud) 我想在我的应用程序的任何地方显示sign_UP表单.我只知道如何使用sign_in表单执行此操作,但使用sign_up表单时,相同的方法不起作用.
[...]
<% unless user_signed_in? %>
<%= form_for("user", :url => user_session_path) do |f| %>
[...]
Run Code Online (Sandbox Code Playgroud)
我在论坛上试了很多天才找到解决这个问题的方法.我希望这里有人可以帮助我.
谢谢!
尝试使用 java mail api 发送电子邮件。我不断收到 MailConnectException。我尝试了多种方法都没有成功解决。
该语句抛出异常
transport.connect("smtp.gmail.com", "someone@gmail.com", "myPassword");
Run Code Online (Sandbox Code Playgroud)
谁能告诉我我做错了什么?
public static void main(String[] args) {
String host = "smtp.gmail.com";
String from = "someone@gmail.com";
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
props.put("mail.smtp.user", from);
props.put("mail.smtp.password", "myPassword");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.auth", "true");
try{
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipients(Message.RecipientType.TO, "someone@hotmail.com");
message.setSubject("sending in a group");
message.setText("Welcome to JavaMail");
Transport transport = session.getTransport("smtp");
transport.connect("smtp.gmail.com", "someone@gmail.com", "myPassword");//CAUSES EXCEPTION
transport.sendMessage(message, message.getAllRecipients());
}catch(MessagingException e){
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
com.sun.mail.util.MailConnectException: Couldn't connect …Run Code Online (Sandbox Code Playgroud) 我最近开始使用 SimpleITK 进行图像配准。对于我当前的项目,我需要配准 X 射线图像和 CT 图像,然后在 X 射线图像上跟踪的 ROI 掩模上应用逆矩阵。
我得到了这一行的逆矩阵:
inverse_transform = final_transform.GetInverse()
Run Code Online (Sandbox Code Playgroud)
如何将变换应用于 ROI 蒙版?
python registration image-processing transformation-matrix simpleitk
请原谅这个相对新手的问题,但我可以使用一些帮助.
我已经在我的用户模型上安装了Devise Gem,只对Devise视图进行了少量更改,并且没有对控制器进行任何更改.不过,我遇到了一个我无法解决的问题.
帐户/编辑网址(我使用'devise_for:users,:path =>"accounts"'定义了路径)按预期显示用户编辑表单.但是,插入新密码的字段预填充了用户的当前密码(当然,type = password).我不希望这个字段预先填充任何内容.因此,每当表单呈现时,我都希望该字段为空白.我在设计/注册/编辑视图中尝试了以下更改,但它没有用空字符串替换预填充密码,就像我希望的那样:
<p><span style = "font-weight:bold; padding:0"><%= f.label "New Password" %></span><br />
<%= f.password_field :password, :value => ""%>
<i>(just leave this blank if you don't want to change your current password)</i></p>
Run Code Online (Sandbox Code Playgroud)
我确信有一个简单的解决方案,但我无法在任何地方找到它.非常感谢帮助.
我是asp.net mvc 3世界的新手我看了一些教程开始.我想知道管理用户的最佳选择是什么?
我打算使用成员资格提供程序(并修改它以扩展默认字段)或使用用户分析+成员资格提供程序?
这些有哪些优点和缺点?一旦我创建了我的应用程序,我的想法是创建一个移动应用程序:用户必须能够通过用户和密码(我的Web应用程序)访问...它会影响我的选择吗?
asp.net-mvc mobile registration membership-provider user-profile
我正在设计一个具有注册过程活动的应用程序,此活动默认启动.我希望在注册过程成功完成后永久禁用此活动,然后应将其替换为不同的活动作为应用程序剩余生命周期的默认活动.我试图通过此搜索问题,但我几乎找不到任何东西.任何帮助将不胜感激.提前致谢.
我正在寻找一种方法来禁用/启用iOS应用程序中的所有触摸事件注册,我搜索了谷歌和stackoverflow但无法找到令人满意的答案.谁可能碰巧知道这件事呢?
我正在使用ASP.Net Web应用程序项目.在我的注册表格中Username,Email将检查它是否存在于数据库中.但我的问题是,如果存在username并且Email存在,用户可以正常注册,他的数据将被添加到数据库中!如何阻止它添加这些数据并强制用户更改username或者Email如果其中一个存在!请帮忙吗?
我的.aspx.cs页面:
protected void Button1_Click(object sender, EventArgs e)
{
byte[] License;
Stream s = FileUpload1.PostedFile.InputStream;
BinaryReader br = new BinaryReader(s);
License = br.ReadBytes((Int32)s.Length);
try
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyDatabase"].ConnectionString);
conn.Open();
string insertQuery = "insert into DeliveryMen (Name,Username,Password,Email,Phone,City,License) values (@name ,@username, @password, @email ,@phone ,@city,@License)";
SqlCommand com = new SqlCommand(insertQuery, conn);
com.Parameters.AddWithValue("@name", TextBoxName.Text);
com.Parameters.AddWithValue("@username", TextBoxUsername.Text);
com.Parameters.AddWithValue("@password", TextBoxPassword.Text);
com.Parameters.AddWithValue("@email", TextBoxEmail.Text);
com.Parameters.AddWithValue("@phone", TextBoxPhone.Text);
com.Parameters.AddWithValue("@city", DropDownList1.SelectedItem.ToString());
com.Parameters.AddWithValue("@License", License); …Run Code Online (Sandbox Code Playgroud) registration ×10
devise ×2
android ×1
asp.net ×1
asp.net-mvc ×1
c# ×1
django ×1
ios ×1
jakarta-mail ×1
java ×1
magento ×1
mobile ×1
python ×1
simpleitk ×1
sql ×1
touch ×1
user-profile ×1
web ×1