开发者

checking out the login result

I am try开发者_JAVA百科ing to integrate cpanel to my cms... I have this code to remote logins:

<form action=’http://www.yourdomain.com:2082/login/’ method=’post’>
<table border=’1′ width=’250′ cellpadding=’2′ cellspacing=’0′>
<tr>
<td align=’right’>Username:</td>
<td><input type=’text’ name=’user’></td>
</tr>
<tr>
<td align=’right’>Password:</td>
<td><input type=’password’ name=’pass’></td>
</tr>
<tr>
<td colspan=’2′ align=’center’><input type=’reset’ name=’r1′ value=’Reset’><input type=’submit’ name=’s1′ value=’Login’></td>
</tr>
</table>
</form>

This form loads cpanel after successful login. I don't want this form to loads cpanel after successful login. I want to load another page of my cms after successful login. So, I would like to check if login is successful or not. I tried to do it with jquery however jquery did not work on cross domain. Does anyone got any suggestion for this situation?


One way to accomplish this would be to use AJAX to submit the form. This way the user is logged in and the cookie is sent to the browser, but the page that is normally shown after successful login won't be displayed.

In your JavaScript you will need to search the xmlHttp.responseText for success and failure texts. For example, if a failed login will produce the text "Invalid username or password", use that as a fail text to search for. If there is something similar that would indicate a successful login, search the text for that. If it is successful, use javascript to forward the browser to your own special logged in page. If not, send an error back to the user.

Edit: I missed the part about it being cross-domain. You can use JSONP for that apparently.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜