Fetch Username from database and display on index page - yii-extensions

i have database table client_info(id,first_name,last_name,email,passowrd).I login in to my site using email and password. on the top right in header section of index/home page ..first_name should display of same user whose email is entered...i:e Welcom:Johen if first_name=john where email=current_email. ..what command should i user echo or CHTML or which model..since index.php have no model its only layout layout/main.php file .using yii framework...

The Yii way to achive this would be to create your own WebUser class which extends from the Yii class CWebUser. When a user is logged in, you should store his username in there. After that, you could simply do
echo Yii::app()->user->username;
and so on. A tutorial on this subject can be found here: http://www.yiiframework.com/wiki/60/

The Yii way to achive this would be to create your own WebUser class which extends from the Yii class CWebUser. When a user is logged in, you should store his username in there. After that, you could simply do
echo Yii::app()->user->user;

Related

Django - How to redirect to particular page after login using Django Panel Login functionality

I am using Class Based View, and in this particular form (based on FormView) I want restrict access to Logged Users only. It somehow works, but I want after user give login / password go back, redirect to particular site - for example named "my_form" or other (could be home page), but in this case, after login Django Admin shows. I need its functionality only for login and I want go back to desired location, 'my_form' page.
How can I achieve this? Don't want decorators here, as I want to use this special Mixin.
class EmployeeLocationFormView(LoginRequiredMixin, FormView):
login_url = 'admin:login'
redirect_field_name = 'my_form'

How to create own login form in Joomla and how to create redirect file after login

I want to create my own login form. After user login , it will redirect to the mainpage which is same page when use default login form in Joomla in template. The problem is, i want to display the page by using my own login form. not use Joomla login form in template. How to create the login form then display on Joomla template? using php? I hope you can help me. I appreciate that.
You will need to override the components/com_users/views/login view in order to modify the look and feel of the login form. Yes - you will need to know/use PHP in order to do that.

show logout button along with the name of user after successfull login

I am a yiibie, and i am stuck at a point. I have three roles in my project. 1.Admin. 2.Owner 3. Authenticated User. I have a header and a footer widget.In header widget which is the top section has a signup and login link. i want to show my user name and a logout link after his successful login. I do not want to make another widget. i Know the logic, we can use if else.
If a user has been logged in, show his name and logout link at the top section(header widget). else if he is a normal user or not logged in show him, signup and login link. Thats it.But how to write code..is the thing i dont know. Plus i am using yii rights and yii user extension too.
Read the documentation please.
This will be helpful:
http://www.yiiframework.com/doc/api/1.1/CWebUser#isGuest-detail
Here example: http://pastebin.com/r0XpkPNZ
Is easy after login you can see the username otherwise you see nothings
<?php
if (!Yii::app()->user->isGuest) {
echo Yii::app()->user->name;
}
?>

How to create customized login component in Salesforce?

I understand that we can create a customized login page in Salesforce; but I should create a login component and embed it in our public pages. I should also create another component that allows the user to log out or log in as as a different user. Is this possible?
Not 100% clear on the exact question here, but you don't need to create any custom components in order to customise the login page. This is now standard with Winter '14 - go to the "My Domain" admin menu item and scroll down to "Login Page Branding".
If you're unable to use this for some reason, or it's not what you're after perhaps you could explain further what you're trying to achieve?

Redirect After Registration in Drupal

Any one know how to go back to the "last page" after a user is presented the login screen and chooses to create a new account?
Basically the sequence is this:
User tries to get to protected content
Redirected to login page
If he logs in he is redirected to original page
If he chooses "create new account" and fills it out, he is redirected to the home page
How do we get him automatically redirected to the original page (not a static page).
There are several ways to go about this. The most straight-forward is to have a login link somewhere in the navigation that appends the destination to the url. The code for this is something like:
<?php
if (user_is_anonymous()) {
$link = l(t('Login'), 'user/login', array('query' => drupal_get_destination()));
}
?>
You can also set a custom access denied page at admin/settings/error-reporting that could either go to a callback that outputs the above code, or to a simple php node that outputs that code.
Additionally, the user login block provided with Drupal core uses the same method to redirect a successful login back to the originating page.
Edit: Note that the above methods will rarely work for registration, because there are more steps involved there. Specifically, when a user needs to verify an email address, passing the originating destination along via the email would involve modifying the core user registration process.
It will potentially still work on a site configured to not verify email addresses. The idea then would be to provide 2 links: 1 for login and the other for registration, both passing along destination information.
LoginToboggan may also be worth pursuing, although it doesn't yet offer the exact registration feature you're looking for.
straight php would be to include a header of this form:
<?php header("Location: " . $_SERVER['HTTP_REFERER']); ?>
for more information refer to the php manual
EDIT:
you can also include a hidden field in your form and set it to
$url = $_SERVER['PHP_SELF']; // or HTTP_REFERER depending on the setup
include the header code snipped to your registration form.